fix malloc_conf feature-awareness
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
936161d89e
commit
eb7d893c86
1 changed files with 19 additions and 12 deletions
|
@ -8,6 +8,7 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use arrayvec::ArrayVec;
|
use arrayvec::ArrayVec;
|
||||||
|
use const_str::concat_bytes;
|
||||||
use tikv_jemalloc_ctl as mallctl;
|
use tikv_jemalloc_ctl as mallctl;
|
||||||
use tikv_jemalloc_sys as ffi;
|
use tikv_jemalloc_sys as ffi;
|
||||||
use tikv_jemallocator as jemalloc;
|
use tikv_jemallocator as jemalloc;
|
||||||
|
@ -20,18 +21,24 @@ use crate::{
|
||||||
|
|
||||||
#[cfg(feature = "jemalloc_conf")]
|
#[cfg(feature = "jemalloc_conf")]
|
||||||
#[unsafe(no_mangle)]
|
#[unsafe(no_mangle)]
|
||||||
pub static malloc_conf: &[u8] = b"\
|
pub static malloc_conf: &[u8] = concat_bytes!(
|
||||||
metadata_thp:always\
|
"lg_extent_max_active_fit:4",
|
||||||
,percpu_arena:percpu\
|
",oversize_threshold:16777216",
|
||||||
,background_thread:true\
|
",tcache_max:2097152",
|
||||||
,max_background_threads:-1\
|
",dirty_decay_ms:16000",
|
||||||
,lg_extent_max_active_fit:4\
|
",muzzy_decay_ms:144000",
|
||||||
,oversize_threshold:16777216\
|
",percpu_arena:percpu",
|
||||||
,tcache_max:2097152\
|
",metadata_thp:always",
|
||||||
,dirty_decay_ms:16000\
|
",background_thread:true",
|
||||||
,muzzy_decay_ms:144000\
|
",max_background_threads:-1",
|
||||||
,prof_active:false\
|
MALLOC_CONF_PROF,
|
||||||
\0";
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
#[cfg(all(feature = "jemalloc_conf", feature = "jemalloc_prof"))]
|
||||||
|
const MALLOC_CONF_PROF: &str = ",prof_active:false";
|
||||||
|
#[cfg(all(feature = "jemalloc_conf", not(feature = "jemalloc_prof")))]
|
||||||
|
const MALLOC_CONF_PROF: &str = "";
|
||||||
|
|
||||||
#[global_allocator]
|
#[global_allocator]
|
||||||
static JEMALLOC: jemalloc::Jemalloc = jemalloc::Jemalloc;
|
static JEMALLOC: jemalloc::Jemalloc = jemalloc::Jemalloc;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue