musl/src/malloc
Rich Felker 5446303328 avoid malloc failure for small requests when brk can't be extended
this issue mainly affects PIE binaries and execution of programs via
direct invocation of the dynamic linker binary: depending on kernel
behavior, in these cases the initial brk may be placed at at location
where it cannot be extended, due to conflicting adjacent maps.

when brk fails, mmap is used instead to expand the heap. in order to
avoid expensive bookkeeping for managing fragmentation by merging
these new heap regions, the minimum size for new heap regions
increases exponentially in the number of regions. this limits the
number of regions, and thereby the number of fixed fragmentation
points, to a quantity which is logarithmic with respect to the size of
virtual address space and thus negligible. the exponential growth is
tuned so as to avoid expanding the heap by more than approximately 50%
of its current total size.
2014-04-02 17:57:15 -04:00
..
__brk.c slightly optimize __brk for size 2013-10-05 12:00:55 -04:00
aligned_alloc.c move core memalign code from aligned_alloc to __memalign 2013-07-04 23:58:16 -04:00
calloc.c include cleanups: remove unused headers and add feature test macros 2013-12-12 05:09:18 +00:00
DESIGN initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00
lite_malloc.c ditch the priority inheritance locks; use malloc's version of lock 2012-04-24 16:32:23 -04:00
malloc.c avoid malloc failure for small requests when brk can't be extended 2014-04-02 17:57:15 -04:00
memalign.c remove redundant check in memalign 2013-07-23 23:40:26 -04:00
posix_memalign.c move core memalign code from aligned_alloc to __memalign 2013-07-04 23:58:16 -04:00