Avoid atexit(3) when possible, disable prof_final by default.

atexit(3) can deadlock internally during its own initialization if
jemalloc calls atexit() during jemalloc initialization.  Mitigate the
impact by restructuring prof initialization to avoid calling atexit()
unless the registered function will actually dump a final heap profile.

Additionally, disable prof_final by default so that this land mine is
opt-in rather than opt-out.

This resolves #144.
This commit is contained in:
Jason Evans
2014-10-08 17:57:19 -07:00
parent 3a8b9b1fd9
commit 57efa7bb0e
4 changed files with 26 additions and 14 deletions

View File

@@ -2,7 +2,7 @@
#ifdef JEMALLOC_PROF
const char *malloc_conf =
"prof:true,prof_thread_active_init:false,lg_prof_sample:0,prof_final:false";
"prof:true,prof_thread_active_init:false,lg_prof_sample:0";
#endif
static void

View File

@@ -1,8 +1,7 @@
#include "test/jemalloc_test.h"
#ifdef JEMALLOC_PROF
const char *malloc_conf =
"prof:true,prof_active:false,prof_final:false";
const char *malloc_conf = "prof:true,prof_active:false";
#endif
static void