From 0ecd5addb1215f5ae9fad2b9cb4cf91ed5376ee8 Mon Sep 17 00:00:00 2001 From: Qi Wang Date: Fri, 11 Jan 2019 11:22:11 -0800 Subject: [PATCH] Force purge on thread death only when w/o bg thds. --- src/tcache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tcache.c b/src/tcache.c index 182e8bf4..9125179a 100644 --- a/src/tcache.c +++ b/src/tcache.c @@ -527,8 +527,8 @@ tcache_destroy(tsd_t *tsd, tcache_t *tcache, bool tsd_tcache) { arena_decay(tsd_tsdn(tsd), arena_get(tsd_tsdn(tsd), 0, false), false, false); - unsigned nthreads = arena_nthreads_get(arena, false); - if (nthreads == 0) { + if (arena_nthreads_get(arena, false) == 0 && + !background_thread_enabled()) { /* Force purging when no threads assigned to the arena anymore. */ arena_decay(tsd_tsdn(tsd), arena, false, true); } else {