Deadlock in atexit
Mike Hommey
mh+jemalloc at glandium.org
Thu May 3 10:09:20 PDT 2012
Hi,
I found a dead-lock with C++ code with stats_print:true. This can happen
if C++ static instances of classes with destructors. What happens at the
low level is that the compiler generates a static initializer that calls
cxa_atexit to register the destructor. In some cases, cxa_atexit calls
calloc, which, in jemalloc, calls malloc_init_hard, which, when the
stats_print option is set to true, calls atexit, which ends up in the
same internal functions cxa_atexit uses. And they set a lock the first
time, so the second time, it just dead-locks.
Mike
More information about the jemalloc-discuss
mailing list