jemalloc and STL

Jason Evans jasone at canonware.com
Mon Oct 8 23:11:26 PDT 2012


On Sep 26, 2012, at 8:13 AM, Aaron Evers <eversa at gmail.com> wrote:
> Is it sufficient to link in jemalloc at compile time (i.e. -ljemalloc)
> if I want it to be used by STL containers?  Or do I need to specify
> the allocator, as in:
> typedef std::list<int, malloc_alloc> mylist;

It should be sufficient to link in jemalloc.  Note however that as far as I know, glibc still has what amounts to a huge stl memory leak that can be worked around by defining GLIBCXX_FORCE_NEW=1 in the environment when running your application.  tcmalloc does this automatically, but jemalloc does not.

Jason


More information about the jemalloc-discuss mailing list