Merge "Make purging clear the current thread cache too."

am: 1eb6d36ba8

Change-Id: Ida14ee2d68346a95064c3d1b2668c3da268d045d
This commit is contained in:
Christopher Ferris 2019-05-01 17:10:25 -07:00 committed by android-build-merger
commit 878909e2aa

View file

@ -103,6 +103,14 @@ int je_mallopt(int param, int value) {
}
return 1;
} else if (param == M_PURGE) {
// Only clear the current thread cache since there is no easy way to
// 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;
}
unsigned narenas;
size_t sz = sizeof(unsigned);
if (je_mallctl("arenas.narenas", &narenas, &sz, nullptr, 0) != 0) {