summaryrefslogtreecommitdiff
path: root/memory
Commit message (Collapse)AuthorAgeFilesLines
* Address some warnings raised by MSVC-32/64.ylavic2019-04-031-4/+4
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1856873 13f79535-47bb-0310-9956-ffa450edef68
* apr_pools: make index(es) an apr_size_t everywhere.ylavic2018-01-261-10/+10
| | | | | | | | Avoids "conversion from 'size_t' to 'apr_uint32_t', possible loss" warnings. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1822357 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_pool_get_tag to retrieve the pool tag name.jorton2017-12-121-0/+4
| | | | | | | | | * memory/unix/apr_pools.c (apr_pool_get_tag): New function. * test/testpools.c: Test it. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1817892 13f79535-47bb-0310-9956-ffa450edef68
* Factor out common code in apr_pools.c. No function changes intended.ivan2017-08-261-43/+28
| | | | | | | | | | * memory/unix/apr_pools.c (allocator_lock, allocator_unlock): New helpers. (apr_allocator_max_free_set, allocator_alloc, allocator_free): Use allocator_lock() and allocator_unlock(). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1806296 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1788334: apr_allocator_align() should take an allocator asylavic2017-04-031-1/+3
| | | | | | | | | | | | argument, for better scalability of the API. Update apr_bucket_alloc_aligned_floor() from r1788335 accordingly. Suggested by ivan. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1789947 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1788346: we don't really need a separate "order" setting forylavic2017-03-241-26/+11
| | | | | | | | allocators and pools, so axe apr_pool_alloc_order_set(). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1788376 13f79535-47bb-0310-9956-ffa450edef68
* apr_allocator, apr_pools: Add apr_allocator_page_size(),ylavic2017-03-231-24/+70
| | | | | | | | | | | | | | apr_allocator_min_order_set() and apr_pool_alloc_order_set() to respectively get the (system's) page size in use, set the minimum allocation size for an allocator and the pool default allocation size (expressed in 2^order pages). Also allows for order-0 allocations (and pools), hence use index MAX_INDEX (instead of index 0) to track oversized nodes. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1788346 13f79535-47bb-0310-9956-ffa450edef68
* apr_allocator: Provide apr_allocator_align() to get the true size thatylavic2017-03-231-4/+26
| | | | | | | | would be allocated for the given size (including the header and alignment). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1788334 13f79535-47bb-0310-9956-ffa450edef68
* Register the pool debug log cleanup handler after emitting thebrane2015-04-241-7/+7
| | | | | | | | global pool creation event. This ensures that the allocation event from the cleanup registration written after the creation event. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1675982 13f79535-47bb-0310-9956-ffa450edef68
* Follow up to r1675967: When pool debugging is enabled, make sure webrane2015-04-241-0/+13
| | | | | | | | don't try to emit any debug events after the debug log file handle has been closed. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1675970 13f79535-47bb-0310-9956-ffa450edef68
* Fix pool debugging output so that creation events arebrane2015-04-241-14/+13
| | | | | | | | always emitted before allocation events and subpool destruction events are emitted on pool clear/destroy for proper accounting. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1675967 13f79535-47bb-0310-9956-ffa450edef68
* Expand apr pools debug output with parent information.striker2015-04-181-1/+3
| | | | | | | | | * memory/unix/apr_pools.c (apr_pool_initialize): Add parent to debug header. (apr_pool_log_event): Add parent to debug output. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1674566 13f79535-47bb-0310-9956-ffa450edef68
* Some improvements to the pool concurrency check codesf2014-05-171-19/+26
| | | | | | | | | | * use defined constants for in_use * don't use C99's __func__ * improve abort message * fix some confusion wrt the destroyed state git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1595549 13f79535-47bb-0310-9956-ffa450edef68
* Don't waste memory when creating or allocating from small, long-livedsf2014-05-141-2/+8
| | | | | | | | | | | | | | | | | | | | | | | APR pools after clearing or destroying pools that allocated larger nodes. When allocating nodes from the bucket allocator (<= 80k or 20 pages), we would eagerly reuse *any* free node that is at least the minimum size. Depending on the pool usage scheme, that extra memory would never be used. This patch limits the node to approximate twice the minimum. * memory/unix/apr_pools.c (allocator_alloc): When searching the buckets for free nodes, limit the range to twice the starting index. Submitted by: Stefan Fuhrmann <stefan fuhrmann wandisco com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1594729 13f79535-47bb-0310-9956-ffa450edef68
* fix comment typossf2014-05-141-2/+2
| | | | | | | s/appropiate/appropriate/ git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1594684 13f79535-47bb-0310-9956-ffa450edef68
* Add option to use guard pagessf2014-05-091-3/+29
| | | | | | | | | | Add new --enable-allocator-guard-pages configure option which works like --enable-allocator-uses-mmap, but will also add inaccessible guard pages before and after each memnode. This will result in higher ressource usage but allow to find/protect against certain buffer overflow/overread bugs. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1593615 13f79535-47bb-0310-9956-ffa450edef68
* Option to detect concurrent accesses to poolssf2014-05-091-3/+101
| | | | | | | | | | | | | | Enabled by new configure option --enable-pool-concurrency-check. Compared to pool-owner-debugging, this only detects cases where there is actual contention between accesses. The advantage is that runtime costs should be relatively low. The diagnostic messages could still use some improvement. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1593614 13f79535-47bb-0310-9956-ffa450edef68
* stop using deprecated versions of APR_FOPEN_* and APR_FPROT_*trawick2014-01-181-2/+3
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1559343 13f79535-47bb-0310-9956-ffa450edef68
* Pool debugging fixessf2013-05-101-1/+6
| | | | | | | | - avoid using a destroyed mutex in apr_pool_clear() - if we create a sub-pool, we don't need to own the pool. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1481186 13f79535-47bb-0310-9956-ffa450edef68
* Fix invalid free when destroying pools created withsf2013-05-031-16/+0
| | | | | | | | | | apr_pool_create_unmanaged_ex() PR: 54892 Submitted by: Valeriy V. Argunov <hzdbyte gmail com> git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1478934 13f79535-47bb-0310-9956-ffa450edef68
* Split apr_pool_check_integrity() into two partssf2013-03-231-3/+18
| | | | | | | | | Run the pool owner check part only after pre-cleanups have been run, in order to give them a chance to kill of any threads that may still be accessing the pool. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1460184 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_pool_owner_set function to allow use of pool debugging with threadssf2013-03-231-0/+6
| | | | | | | | | | | | | | Actually this function has been mentioned in the docs for over 10 years but has never been implemented. Also consistently destroy the thread's pool when it exits normally, not only on apr_thread_exit(). This was already done on OS2. Other platforms than unix are untested. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1460182 13f79535-47bb-0310-9956-ffa450edef68
* change pool debugging messages to be uniquesf2013-03-231-3/+3
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1460180 13f79535-47bb-0310-9956-ffa450edef68
* Add valgrind supportsf2013-01-261-19/+126
| | | | | | | | | | | | | | | | | Teach valgrind about apr pools, allocators, and bucket allocators if --with-valgrind is passed to configure. This has less impact on program behavior and performance than compiling with complete pool-debugging. Even with valgrind support compiled in, the performance impact if not running under valgrind should be minimal. It may make sense to use pool-debugging together with valgrind support because pool-debugging does not help with allocators and bucket allocators. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1438957 13f79535-47bb-0310-9956-ffa450edef68
* Don't leak memnodes in apr_pvsprintf() if out of memory and no pool abortsf2013-01-261-13/+13
| | | | | | | function is set. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1438940 13f79535-47bb-0310-9956-ffa450edef68
* extend comment a bitsf2011-06-011-3/+3
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1130274 13f79535-47bb-0310-9956-ffa450edef68
* Fix crash with --enable-allocator-uses-mmap on machines with pagesize >= 8k.sf2011-06-011-1/+6
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1130270 13f79535-47bb-0310-9956-ffa450edef68
* * memory/unix/apr_pools.c (apr_pool_cleanup_register): jorton2011-03-161-0/+4
| | | | | | | | [APR_POOL_DEBUG]: Catch NULL arguments which would lead to strange segfaults later. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1082177 13f79535-47bb-0310-9956-ffa450edef68
* Add new configure option --enable-allocator-uses-mmap to use mmapsf2011-02-181-1/+56
| | | | | | | | | | | | | | | instead of malloc in apr_allocator_alloc(). This greatly reduces memory fragmentation with malloc implementations (e.g. glibc) that don't handle allocationss of a page-size-multiples in an efficient way. It also makes apr_allocator_max_free_set() actually have some effect on such platforms. The handling of page sizes other than 4k seems like a lot of trouble for a very small number of platforms, but there does not seem to be a reasonable way to check this at compile time. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@1072165 13f79535-47bb-0310-9956-ffa450edef68
* Fix various off-by-one errors related to current_free_index:sf2010-08-281-7/+7
| | | | | | | | current_free_index counts pages of size BOUNDARY_SIZE, but every node contains index + 1 of such pages git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@990435 13f79535-47bb-0310-9956-ffa450edef68
* re-commit r761344 which was accidentally reverted by r795598:sf2010-08-281-11/+5
| | | | | | | | | | | Author: Mladen Turk <mturk@apache.org> Date: Thu Apr 2 16:58:40 2009 +0000 Both cleanup and pre_cleanup can share the same free list. Axe the free_pre_cleanups and use free_cleanups for both git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@990431 13f79535-47bb-0310-9956-ffa450edef68
* Fix various issues found by cppchecksf2010-07-271-0/+1
| | | | | | | | | | | | - error handling issues - use of uninitialized data - null pointer dereference - unused variables - memory/fd leaks - broken code in threadproc/beos/proc.c git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@979891 13f79535-47bb-0310-9956-ffa450edef68
* Remove all deprecated pool*_core functions. (renamed to _unmanaged)pquerna2009-12-251-39/+0
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@893840 13f79535-47bb-0310-9956-ffa450edef68
* Please review;wrowe2009-12-191-10/+8
| | | | | | | | Unless the granularity is 4GB, there appears to be a truncation issue using 32 bit ints on a 64 bit memory architecture platform. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@892435 13f79535-47bb-0310-9956-ffa450edef68
* Cleanups for various gcc warnings, conditional assignment and type errorswrowe2009-12-181-11/+20
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@892387 13f79535-47bb-0310-9956-ffa450edef68
* Nothing interesting existed in apr_common_private.h, this wouldwrowe2009-12-181-0/+2
| | | | | | | | | | | | | | | | have just as well been an include/arch/unix/apr_arch_common.h but is entirely unnecessary. The right solution is dozens of lines less code and confusion, simply drive apr_filepath_list_split|merge from filepath_util.c brought in from the unix/ directory, across all platforms. One 'temporary' cast was in use by apr_pools.c, the other was entirely unused. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@892127 13f79535-47bb-0310-9956-ffa450edef68
* SECURITY: CVE-2009-2412 (cve.mitre.org)wrowe2009-08-041-7/+15
| | | | | | | | | | | | | | | | | | | | Fix overflow in pools and rmm, where size alignment was taking place. Reported by: Matt Lewis <mattlewis@google.com> * CHANGES Add entry for CVE-2009-2412. * memory/unix/apr_pools.c (allocator_alloc, apr_palloc): Check for overflow after aligning size. (apr_pcalloc): Drop aligning of size; clearing what the caller asked for should suffice. * util-misc/apr_rmm.c (apr_rmm_malloc, apr_rmm_calloc, apr_rmm_realloc): Check for overflow after aligning size. Submitted by: Matt Lewis <mattlewis@google.com>, Sander Striker git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@800730 13f79535-47bb-0310-9956-ffa450edef68
* Reveert pool code back to r751657, before we got a little crazy and tried to ↵pquerna2009-07-191-206/+496
| | | | | | use malloc() directly. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@795598 13f79535-47bb-0310-9956-ffa450edef68
* Add missing debug unmanaged fn thunkmturk2009-07-181-0/+8
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@795384 13f79535-47bb-0310-9956-ffa450edef68
* Add unmanaged pools from 1.4 branchmturk2009-07-181-26/+75
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@795381 13f79535-47bb-0310-9956-ffa450edef68
* Make final_block dynamic.mturk2009-04-031-9/+12
| | | | | | It is used only so we can create our mutex that will survive pool_clear git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@761692 13f79535-47bb-0310-9956-ffa450edef68
* * Correctly setup size field for the final_blocks field.rpluem2009-04-031-0/+1
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@761662 13f79535-47bb-0310-9956-ffa450edef68
* Use smaller block size and grow exponentially mturk2009-04-031-8/+12
| | | | | | Still cannot figure out for wth is final_block used for... git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@761587 13f79535-47bb-0310-9956-ffa450edef68
* Both cleanup and pre_cleanup can share the same free list.mturk2009-04-021-12/+5
| | | | | | Axe the free_pre_cleanups and use free_cleanups for both git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@761344 13f79535-47bb-0310-9956-ffa450edef68
* I stil think this implementation should go away...mturk2009-04-021-2/+21
| | | | | | | Anyhow, no need to store the pointer to already linked list just to be able to call the free on that pointer git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@761339 13f79535-47bb-0310-9956-ffa450edef68
* * The previous pool implementation used a less fine grained lockingrpluem2009-03-281-7/+15
| | | | | | | | | | | | mechanism. If it was not provided with a separate allocator it used the parent allocator for locking. Use the still present allocator argument to apr_pool_create_ex to determine the correct level of granularity: If no allocator is passed in use the mutex from the parent instead of creating a new one by our self. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@759519 13f79535-47bb-0310-9956-ffa450edef68
* * memory/unix/apr_pools.c (struct apr_pool_t): Inline two block structuresjorton2009-03-261-6/+9
| | | | | | | | | | to avoid having to malloc them in apr_pool_create. (apr_pool_create): Switch the ->blocks pointer between the two block structures. Avoid freeing either. (block_list_destroy_all): Don't free the final block_list_t. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@758648 13f79535-47bb-0310-9956-ffa450edef68
* * Remove another unneeded callocrpluem2009-03-261-1/+3
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@758623 13f79535-47bb-0310-9956-ffa450edef68
* * 512 is a more reasonable size for the list.rpluem2009-03-261-1/+1
| | | | | | | Plus the struct now fits in an 8k page. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@758622 13f79535-47bb-0310-9956-ffa450edef68
* * Don't destroy our own pool mutex in apr_pool_clear.rpluem2009-03-261-0/+8
| | | | git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@758619 13f79535-47bb-0310-9956-ffa450edef68