Skip to content

Commit cacd7c2

Browse files
authored
Merge pull request #770 from fabriziosestito/fix/configure-jemalloc-lib
fix: configure jemalloc in lib.rs
2 parents e588d2e + a86f8e5 commit cacd7c2

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/lib.rs

+11
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ use crate::evaluation::{
5050
use crate::policy_downloader::{Downloader, FetchedPolicies};
5151
use config::Config;
5252

53+
use tikv_jemallocator::Jemalloc;
54+
55+
#[global_allocator]
56+
static GLOBAL: Jemalloc = Jemalloc;
57+
58+
#[allow(non_upper_case_globals)]
59+
#[export_name = "malloc_conf"]
60+
/// Prioritize memory usage, then enable features request by pprof but do not activate them by
61+
/// default. When pprof is activate there's a CPU overhead.
62+
pub static malloc_conf: &[u8] = b"background_thread:true,tcache_max:4096,dirty_decay_ms:5000,muzzy_decay_ms:5000,abort_conf:true,prof:true,prof_active:false,lg_prof_sample:19\0";
63+
5364
pub struct PolicyServer {
5465
router: Router,
5566
callback_handler: CallbackHandler,

src/main.rs

-11
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,6 @@ use policy_server::metrics::setup_metrics;
1010
use policy_server::tracing::setup_tracing;
1111
use policy_server::PolicyServer;
1212

13-
use tikv_jemallocator::Jemalloc;
14-
15-
#[global_allocator]
16-
static GLOBAL: Jemalloc = Jemalloc;
17-
18-
#[allow(non_upper_case_globals)]
19-
#[export_name = "malloc_conf"]
20-
/// Prioritize memory usage, then enable features request by pprof but do not activate them by
21-
/// default. When pprof is activate there's a CPU overhead.
22-
pub static malloc_conf: &[u8] = b"background_thread:true,tcache_max:4096,dirty_decay_ms:5000,muzzy_decay_ms:5000,abort_conf:true,prof:true,prof_active:false,lg_prof_sample:19\0";
23-
2413
#[tokio::main]
2514
async fn main() -> Result<()> {
2615
let matches = cli::build_cli().get_matches();

tests/common/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub(crate) fn default_test_config() -> Config {
6969
daemon_pid_file: "policy_server.pid".to_owned(),
7070
daemon_stdout_file: None,
7171
daemon_stderr_file: None,
72-
enable_pprof: true,
72+
enable_pprof: false,
7373
continue_on_errors: false,
7474
}
7575
}

0 commit comments

Comments
 (0)