diff --git a/Cargo.toml b/Cargo.toml index 5e9b6ac..0ee5f79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,6 +27,7 @@ hickory-proto = "0.24" httparse = "1" ipstack = { version = "0.1" } log = { version = "0.4", features = ["std"] } +mimalloc = { version = "0.1", default-features = false, optional = true } percent-encoding = "2" socks5-impl = { version = "0.5" } thiserror = "1" diff --git a/src/lib.rs b/src/lib.rs index 5f66aad..3df7040 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,10 @@ pub use { traffic_status::{tun2proxy_set_traffic_status_callback, TrafficStatus}, }; +#[cfg(feature = "mimalloc")] +#[global_allocator] +static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc; + #[cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))] pub use desktop_api::desktop_run_async;