From 5cda74e065761bbeccf7ff61d7a3131bdf6490d0 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Mon, 8 Jul 2019 14:54:58 -0700 Subject: Do not check tcache clear when doing a purge. On systems where the tcache is disabled, the tcache clear option will fail, and not really do a purge. Bug: 137037462 Bug: 136236080 Test: Built taimen as malloc svelte and verified the M_PURGE mallopt Test: call failed before this fix and passes afterwards. Change-Id: Ib30e5f3e083a9c6d046adff30f2aa7eacaf6df10 Merged-In: Ib30e5f3e083a9c6d046adff30f2aa7eacaf6df10 (cherry picked from commit 3d0bafb945bc9e39ddc84a0167e713b8e70dc135) --- libc/bionic/jemalloc_wrapper.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libc/bionic/jemalloc_wrapper.cpp b/libc/bionic/jemalloc_wrapper.cpp index bf0494dde..7d0445784 100644 --- a/libc/bionic/jemalloc_wrapper.cpp +++ b/libc/bionic/jemalloc_wrapper.cpp @@ -107,9 +107,8 @@ int je_mallopt(int param, int value) { // clear the caches of other threads. // This must be done first so that cleared allocations get purged // in the next calls. - if (je_mallctl("thread.tcache.flush", nullptr, nullptr, nullptr, 0) != 0) { - return 0; - } + // Ignore the return call since this will fail if the tcache is disabled. + je_mallctl("thread.tcache.flush", nullptr, nullptr, nullptr, 0); unsigned narenas; size_t sz = sizeof(unsigned); -- cgit v1.2.3