git: libc - Improve realloc() performance.

Matthias Play matthias_play at gmx.net
Fri Feb 19 03:47:07 PST 2016


Hi,

this reminds me to ask if DragionFly is effected by the recently 
discovered stack-based buffer overflow bug in glibc:

https://sourceware.org/ml/libc-alpha/2016-02/msg00416.html

Regrds
Matthias

On 17.02.16 19:39, Matthew Dillon wrote:
> commit 07a8ffeaab3fc830679c6836a6ee198ad1a3275f
> Author: Matthew Dillon <dillon at apollo.backplane.com>
> Date:   Tue Feb 16 20:40:44 2016 -0800
>
>      libc - Improve realloc() performance.
>
>      * Oversized free()'s <= 1MB will be cached in a 16-entry array.  Any oversized
>        allocation can make use of the cache, even if available cache entries are
>        significantly larger than desired, in order to accomodate application
>        buffer-growing behavior.  This means that applications which realloc() a
>        lot (at least as long as the buffer is <= 1MB) will wind up being handed
>        a ~1MB buffer quite frequently, eliminating new mmap() operations.
>
>      * Keeps track of the excess in oversized allocations and will garbage-collect
>        it if it grows too large (typically > 16MB).  This is primarily what allows
>        us to be generous.
>
>      * realloc() will attempt to use MAP_TRYFIXED to extend an oversized allocation
>        before giving up and remapping it.
>
>      * Improves programs which realloc() or malloc()/free() large numbers of
>        oversized blocks by reducing or eliminating mmap()/munmap() calls.
>
> Summary of changes:
>   lib/libc/stdlib/nmalloc.c | 250 +++++++++++++++++++++++++++++++++++++++++-----
>   1 file changed, 227 insertions(+), 23 deletions(-)
>
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/07a8ffeaab3fc830679c6836a6ee198ad1a3275f
>
>



More information about the Commits mailing list