From 0a37cb80f78735900cd745fc813c40ead438c0fb Mon Sep 17 00:00:00 2001 From: Marko Mikulicic Date: Tue, 25 May 2021 03:40:17 +0200 Subject: [PATCH] feat: Use jemalloc everywhere instead of malloc There may be many reasons for the discrepancy in jemalloc reported allocations total sizes and RSS. One of them is that our binary doesn't use jmalloc for all the allocations. Turns out that jemallocator only sets the global rust allocator. Any call to `malloc` will still go throught the system allocator. Presumably those calls come from linked C code, but it's also not impossible that not all rust code honours the global allocator (I have no idea, but let's see) --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a88f69ec28..aad9b2df9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -100,7 +100,7 @@ serde_urlencoded = "0.7.0" snafu = "0.6.9" structopt = "0.3.21" thiserror = "1.0.23" -tikv-jemallocator = "0.4.0" +tikv-jemallocator = {version = "0.4.0", features = ["unprefixed_malloc_on_supported_platforms"] } tikv-jemalloc-ctl = "0.4.0" tokio = { version = "1.0", features = ["macros", "rt-multi-thread", "parking_lot", "signal"] } tokio-stream = { version = "0.1.2", features = ["net"] }