diff --git a/Cargo.lock b/Cargo.lock index 5123102..237bf9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -864,6 +864,7 @@ dependencies = [ "chrono", "hex", "image", + "jemallocator", "kamadak-exif", "minijinja", "serde", @@ -888,6 +889,26 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +[[package]] +name = "jemalloc-sys" +version = "0.5.3+5.3.0-patched" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9bd5d616ea7ed58b571b2e209a65759664d7fb021a0819d7a790afc67e47ca1" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "jemallocator" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16c2514137880c52b0b4822b563fadd38257c1f380858addb74a400889696ea6" +dependencies = [ + "jemalloc-sys", + "libc", +] + [[package]] name = "jobserver" version = "0.1.26" diff --git a/Cargo.toml b/Cargo.toml index ef67a23..f2c2177 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ chacha20poly1305 = { version = "0.10.1", features = ["std"] } chrono = "0.4.24" hex = { version = "0.4.3", features = ["serde"] } image = { version = "0.24.5", default-features = false, features = ["jpeg", "webp-encoder"] } +jemallocator = "0.5.0" kamadak-exif = "0.5.5" minijinja = "0.30.4" serde = { version = "1.0.152", features = ["derive"] } diff --git a/src/main.rs b/src/main.rs index 8e9d178..5c90463 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,9 @@ use tracing_subscriber::{EnvFilter, layer::SubscriberExt, util::SubscriberInitEx mod error; +#[global_allocator] +static GLOBAL: jemallocator::Jemalloc = jemallocator::Jemalloc; + // TODO // * Polish the css // * Add configuration file