Mem leak : malloc/free + pthreads = leakage?

Ivan Voras ivoras at freebsd.org
Tue Mar 8 03:27:29 UTC 2011


On 06/03/2011 18:35, Ryan Stone wrote:
> On Sun, Mar 6, 2011 at 10:34 AM, Ryan Stone<rysto32 at gmail.com>  wrote:
>> I would try playing with MALLOC_OPTIONS.  I seriously doubt that there
>> is an actual leak in jemalloc, but from my own experiences with it I
>> suspect that there are certain multithreaded malloc/free sequences
>> that interact badly with with the per-thread caching that jemalloc
>> performs.  The first thing I would try is setting MALLOC_OPTIONS=7h to
>> disable the caching.
>>
>
> Wait, sorry, apparently this is a new option in HEAD.  Under 8.1
> MALLOC_OPTIONS=g will disable the thread-specific caching.  See the
> malloc(3) man page for the definitive list of available options.

I can confirm this suspicion; I have an malloc-intensive multithreaded 
program on 8-STABLE which I need to run with MALLOC_OPTIONS g10f2n to 
reduce otherwise severe memory lossage by the allocator. I haven't tried 
it on 9, though.




More information about the freebsd-hackers mailing list