diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-10-20 00:19:25 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-10-20 00:19:25 +0000 |
commit | 88aacf8b28afc7ac7c4068d89041cd5af15a2906 (patch) | |
tree | 3ad18c057933a7ed26c927a7e1703b472aee2724 | |
parent | dbf4b11b1158137e55342d250f624196a8912e07 (diff) | |
parent | 5e8614d22e9ded651791553b2bf27c50fa0ff914 (diff) | |
download | bionic-pie-qpr1-release.tar.gz |
Merge cherrypicks of [5317808, 5317809, 5318498, 5317873, 5318338, 5318195, 5318499, 5317874, 5317875, 5317876, 5318243, 5318244, 5318537, 5318538, 5318539, 5318540, 5318541, 5318542, 5318543, 5318544, 5318545, 5318546, 5315210, 5317756, 5318557, 5318558, 5318559, 5318560, 5318561, 5318339, 5318547, 5318548, 5318549, 5318562, 5318563, 5318564, 5318565, 5318566, 5318172, 5318173, 5318174, 5318550, 5318401, 5318196, 5317889, 5318175, 5318176, 5318577, 5318578, 5318579, 5318580, 5318581, 5318503, 5318390, 5318505, 5318341, 5318551] into pi-qpr1-releaseandroid-9.0.0_r30android-9.0.0_r22android-9.0.0_r21android-9.0.0_r20android-9.0.0_r19pie-qpr1-s3-releasepie-qpr1-s2-releasepie-qpr1-release
Change-Id: I91a3bf454e0eb31e4d34779e2ff1bf2783c6bf09
-rw-r--r-- | libc/bionic/jemalloc_wrapper.cpp | 12 | ||||
-rw-r--r-- | libc/include/malloc.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/libc/bionic/jemalloc_wrapper.cpp b/libc/bionic/jemalloc_wrapper.cpp index 19081a4c5..0e82066ee 100644 --- a/libc/bionic/jemalloc_wrapper.cpp +++ b/libc/bionic/jemalloc_wrapper.cpp @@ -79,6 +79,18 @@ int je_mallopt(int param, int value) { } } return 1; + } else if (param == M_PURGE) { + unsigned narenas; + size_t sz = sizeof(unsigned); + if (je_mallctl("arenas.narenas", &narenas, &sz, nullptr, 0) != 0) { + return 0; + } + char buffer[100]; + snprintf(buffer, sizeof(buffer), "arena.%u.purge", narenas); + if (je_mallctl(buffer, nullptr, nullptr, nullptr, 0) != 0) { + return 0; + } + return 1; } return 0; } diff --git a/libc/include/malloc.h b/libc/include/malloc.h index 3a678a94e..d850a3b83 100644 --- a/libc/include/malloc.h +++ b/libc/include/malloc.h @@ -79,6 +79,7 @@ int malloc_info(int __must_be_zero, FILE* __fp) __INTRODUCED_IN(23); /* mallopt options */ #define M_DECAY_TIME -100 +#define M_PURGE -101 int mallopt(int __option, int __value) __INTRODUCED_IN(26); /* |