Skip to content

Commit ea72180

Browse files
committed
use jemalloc under linux gnu/musl
stolen from linkerd/linkerd2@aaa6091 and advice from clux/muslrust#142 Signed-off-by: clux <[email protected]>
1 parent 17a06ed commit ea72180

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

Cargo.lock

+21
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ thiserror = "2.0.11"
4545
anyhow = "1.0.95"
4646
prometheus-client = "0.23.1"
4747

48+
[target.'cfg(target_os = "linux")'.dependencies]
49+
jemallocator = "0.5"
50+
4851
[dev-dependencies]
4952
assert-json-diff = "2.0.2"
5053
http = "1"

src/main.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
#![allow(unused_imports, unused_variables)]
21
use actix_web::{get, middleware, web::Data, App, HttpRequest, HttpResponse, HttpServer, Responder};
32
pub use controller::{self, telemetry, State};
43

4+
#[cfg(all(target_os = "linux", target_arch = "x86_64"))]
5+
#[global_allocator]
6+
static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc;
7+
58
#[get("/metrics")]
69
async fn metrics(c: Data<State>, _req: HttpRequest) -> impl Responder {
710
let metrics = c.metrics();

0 commit comments

Comments
 (0)