Memory Leak in Thread Cleanup (jemalloc 4.0.4)
Christopher Ferris
cferris at google.com
Thu Feb 11 14:33:48 PST 2016
It appears, that under certain circumstances, the arenas_cache can be
leaked when shutting down a thread.
Specifically, in tsd.c (function tsd_cleanup), this code:
#define O(n, t) \
n##_cleanup(tsd);
MALLOC_TSD
#undef O
tsd->state = tsd_state_purgatory;
tsd_set(tsd);
break;
The cleanup part can wind up creating an arenas_cache, then the tsd_set
clears the arenas_cache pointer, and the memory is leaked away.
I added this call:
arenas_cache_cleanup(tsd_get());
After the undef and before the tsd->state, and the leak disappears. I'm not
sure if there is a better way to fix this though.
Thanks,
Christopher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jemalloc.net/mailman/jemalloc-discuss/attachments/20160211/65b9a617/attachment.html>
More information about the jemalloc-discuss
mailing list