diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in
index 1f692f78..7da1498a 100644
--- a/doc/jemalloc.xml.in
+++ b/doc/jemalloc.xml.in
@@ -857,8 +857,14 @@ for (i = 0; i < nbins; i++) {
is specified during configuration, this
has the potential to cause deadlock for a multi-threaded process that
exits while one or more threads are executing in the memory allocation
- functions. Therefore, this option should only be used with care; it is
- primarily intended as a performance tuning aid during application
+ functions. Furthermore, atexit may
+ allocate memory during application initialization and then deadlock
+ internally when jemalloc in turn calls
+ atexit, so this option is not
+ univerally usable (though the application can register its own
+ atexit function with equivalent
+ functionality). Therefore, this option should only be used with care;
+ it is primarily intended as a performance tuning aid during application
development. This option is disabled by default.
@@ -1155,7 +1161,13 @@ malloc_conf = "xmalloc:true";]]>
<prefix>.<pid>.<seq>.f.heap,
where <prefix> is controlled by the opt.prof_prefix
- option. This option is enabled by default.
+ option. Note that atexit may allocate
+ memory during application initialization and then deadlock internally
+ when jemalloc in turn calls atexit, so
+ this option is not univerally usable (though the application can
+ register its own atexit function with
+ equivalent functionality). This option is disabled by
+ default.
diff --git a/src/prof.c b/src/prof.c
index b3150a27..3e2e4277 100644
--- a/src/prof.c
+++ b/src/prof.c
@@ -20,7 +20,7 @@ bool opt_prof_thread_active_init = true;
size_t opt_lg_prof_sample = LG_PROF_SAMPLE_DEFAULT;
ssize_t opt_lg_prof_interval = LG_PROF_INTERVAL_DEFAULT;
bool opt_prof_gdump = false;
-bool opt_prof_final = true;
+bool opt_prof_final = false;
bool opt_prof_leak = false;
bool opt_prof_accum = false;
char opt_prof_prefix[
@@ -1487,17 +1487,17 @@ prof_fdump(void)
char filename[DUMP_FILENAME_BUFSIZE];
cassert(config_prof);
+ assert(opt_prof_final);
+ assert(opt_prof_prefix[0] != '\0');
if (!prof_booted)
return;
tsd = tsd_fetch();
- if (opt_prof_final && opt_prof_prefix[0] != '\0') {
- malloc_mutex_lock(&prof_dump_seq_mtx);
- prof_dump_filename(filename, 'f', VSEQ_INVALID);
- malloc_mutex_unlock(&prof_dump_seq_mtx);
- prof_dump(tsd, false, filename, opt_prof_leak);
- }
+ malloc_mutex_lock(&prof_dump_seq_mtx);
+ prof_dump_filename(filename, 'f', VSEQ_INVALID);
+ malloc_mutex_unlock(&prof_dump_seq_mtx);
+ prof_dump(tsd, false, filename, opt_prof_leak);
}
void
@@ -2023,7 +2023,8 @@ prof_boot2(void)
if (malloc_mutex_init(&prof_dump_mtx))
return (true);
- if (atexit(prof_fdump) != 0) {
+ if (opt_prof_final && opt_prof_prefix[0] != '\0' &&
+ atexit(prof_fdump) != 0) {
malloc_write(": Error in atexit()\n");
if (opt_abort)
abort();
diff --git a/test/unit/prof_active.c b/test/unit/prof_active.c
index d4bab8d0..81490957 100644
--- a/test/unit/prof_active.c
+++ b/test/unit/prof_active.c
@@ -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
diff --git a/test/unit/prof_thread_name.c b/test/unit/prof_thread_name.c
index 6066dba7..f501158d 100644
--- a/test/unit/prof_thread_name.c
+++ b/test/unit/prof_thread_name.c
@@ -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