Merge "Move to jemalloc5."
This commit is contained in:
commit
17c4bd9e59
2 changed files with 16 additions and 9 deletions
|
@ -65,7 +65,7 @@ cc_defaults {
|
|||
cppflags: [],
|
||||
include_dirs: [
|
||||
"bionic/libc/async_safe/include",
|
||||
"external/jemalloc/include",
|
||||
"external/jemalloc_new/include",
|
||||
],
|
||||
|
||||
stl: "none",
|
||||
|
@ -1597,7 +1597,7 @@ cc_library_static {
|
|||
"libc_syscalls",
|
||||
"libc_tzcode",
|
||||
"libm",
|
||||
"libjemalloc",
|
||||
"libjemalloc5",
|
||||
"libstdc++",
|
||||
],
|
||||
}
|
||||
|
@ -1782,7 +1782,7 @@ cc_library {
|
|||
"libdl",
|
||||
],
|
||||
whole_static_libs: [
|
||||
"libjemalloc",
|
||||
"libjemalloc5",
|
||||
],
|
||||
|
||||
nocrt: true,
|
||||
|
|
|
@ -52,11 +52,11 @@ int je_mallopt(int param, int value) {
|
|||
// The only parameter we currently understand is M_DECAY_TIME.
|
||||
if (param == M_DECAY_TIME) {
|
||||
// Only support setting the value to 1 or 0.
|
||||
ssize_t decay_time;
|
||||
ssize_t decay_time_ms;
|
||||
if (value) {
|
||||
decay_time = 1;
|
||||
decay_time_ms = 1000;
|
||||
} else {
|
||||
decay_time = 0;
|
||||
decay_time_ms = 0;
|
||||
}
|
||||
// First get the total number of arenas.
|
||||
unsigned narenas;
|
||||
|
@ -66,15 +66,22 @@ int je_mallopt(int param, int value) {
|
|||
}
|
||||
|
||||
// Set the decay time for any arenas that will be created in the future.
|
||||
if (je_mallctl("arenas.decay_time", nullptr, nullptr, &decay_time, sizeof(decay_time)) != 0) {
|
||||
if (je_mallctl("arenas.dirty_decay_ms", nullptr, nullptr, &decay_time_ms, sizeof(decay_time_ms)) != 0) {
|
||||
return 0;
|
||||
}
|
||||
if (je_mallctl("arenas.muzzy_decay_ms", nullptr, nullptr, &decay_time_ms, sizeof(decay_time_ms)) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Change the decay on the already existing arenas.
|
||||
char buffer[100];
|
||||
for (unsigned i = 0; i < narenas; i++) {
|
||||
snprintf(buffer, sizeof(buffer), "arena.%d.decay_time", i);
|
||||
if (je_mallctl(buffer, nullptr, nullptr, &decay_time, sizeof(decay_time)) != 0) {
|
||||
snprintf(buffer, sizeof(buffer), "arena.%d.dirty_decay_ms", i);
|
||||
if (je_mallctl(buffer, nullptr, nullptr, &decay_time_ms, sizeof(decay_time_ms)) != 0) {
|
||||
break;
|
||||
}
|
||||
snprintf(buffer, sizeof(buffer), "arena.%d.muzzy_decay_ms", i);
|
||||
if (je_mallctl(buffer, nullptr, nullptr, &decay_time_ms, sizeof(decay_time_ms)) != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue