diff --git a/ChangeLog b/ChangeLog index c8865059..80a21e79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,10 @@ found in the git revision history: - Auto-detect whether running inside Valgrind, thus removing the need to manually specify MALLOC_CONF=valgrind:true. + Incompatible changes: + - Disable tcache by default if running inside Valgrind, in order to avoid + making unallocated objects appear reachable to Valgrind. + Bug fixes: - Fix heap profiling crash if sampled object is freed via realloc(p, 0). diff --git a/doc/jemalloc.xml.in b/doc/jemalloc.xml.in index 8a13a22c..b34467be 100644 --- a/doc/jemalloc.xml.in +++ b/doc/jemalloc.xml.in @@ -969,7 +969,8 @@ malloc_conf = "xmalloc:true";]]> opt.lg_tcache_max option for related tuning information. This option is enabled by - default. + default unless running inside Valgrind. diff --git a/src/jemalloc.c b/src/jemalloc.c index 77ea8c81..481936dc 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -389,6 +389,8 @@ malloc_conf_init(void) opt_quarantine = JEMALLOC_VALGRIND_QUARANTINE_DEFAULT; opt_redzone = true; } + if (config_tcache && opt_valgrind) + opt_tcache = false; } for (i = 0; i < 3; i++) {