Branch: Tag:


2012-08-17 13:34:11 by Henrik Grubbström (Grubba) <>

Runtime: Tune malloc(3C) in glibc. Alleviates [bug 6045 (#6045)].

Malloc(3C) in glibc defaults to having one pool (aka arena) of memory
per thread. This means that by default memory released by one thread
will not be reused by another thread. This in turn can cause a "pumping"
effect where one thread temporarily may use a lot of memory, which
causes that thread's arena to grow. If the same code is run again later,
but by a different thread, that threads arena will grow even though
there's plenty of free memory in the old arena. This means that there's
a multiplication effect by the number of active threads.

This implements the suggested work-around from the similar bug at

4573:    gmtime_r \    gmtime_s \    mallinfo \ +  mallopt \    memchr \    mktime \    perror \