fix bug - hardcoded wrong arena

This commit is contained in:
antoniofilipovic 2024-02-08 10:43:58 +01:00
parent 0e2e12d218
commit 57f160707e

View File

@ -224,18 +224,19 @@ void SetHooks() {
LOG_FATAL("Error setting custom hooks for jemalloc arena {}", i);
}
}
auto last_arena = n_arenas;
// For oversize arena, no need to read hooks, it will be intialized
// with arena, just set our custom hooks
std::string func_name = "arena." + std::to_string(8) + ".extent_hooks";
std::string func_name = "arena." + std::to_string(last_arena) + ".extent_hooks";
if (err) {
LOG_FATAL("Error setting jemalloc hooks for jemalloc arena {}", 8);
LOG_FATAL("Error setting jemalloc hooks for jemalloc arena {}", last_arena);
}
err = mallctl(func_name.c_str(), nullptr, nullptr, &new_hooks, sizeof(new_hooks));
if (err) {
LOG_FATAL("Error setting custom hooks for jemalloc arena {}", 8);
LOG_FATAL("Error setting custom hooks for jemalloc oversize threshold arena {}", last_arena);
}
#endif