• R
    refactor malloc's expand_heap to share with __simple_malloc · e3bc22f1
    Rich Felker 提交于
    this extends the brk/stack collision protection added to full malloc
    in commit 276904c2 to also protect the
    __simple_malloc function used in static-linked programs that don't
    reference the free function.
    
    it also extends support for using mmap when brk fails, which full
    malloc got in commit 54463033, to
    __simple_malloc.
    
    since __simple_malloc may expand the heap by arbitrarily large
    increments, the stack collision detection is enhanced to detect
    interval overlap rather than just proximity of a single address to the
    stack. code size is increased a bit, but this is partly offset by the
    sharing of code between the two malloc implementations, which due to
    linking semantics, both get linked in a program that needs the full
    malloc with realloc/free support.
    e3bc22f1
expand_heap.c 1.8 KB