Use jemalloc

This commit is contained in:
2026-05-17 12:07:28 +02:00
parent 364fd768b3
commit 93a87088db
3 changed files with 26 additions and 0 deletions

21
Cargo.lock generated
View File

@@ -2471,6 +2471,7 @@ dependencies = [
"slint", "slint",
"slint-build", "slint-build",
"thumbhash", "thumbhash",
"tikv-jemallocator",
"tokio", "tokio",
"tracing", "tracing",
"tracing-subscriber", "tracing-subscriber",
@@ -5289,6 +5290,26 @@ dependencies = [
"zune-jpeg", "zune-jpeg",
] ]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.6.1+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8aa5b2ab86a2cefa406d889139c162cbb230092f7d1d7cbc1716405d852a3b"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0359b4327f954e0567e69fb191cf1436617748813819c94b8cd4a431422d053a"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]] [[package]]
name = "tiny-skia" name = "tiny-skia"
version = "0.11.4" version = "0.11.4"

View File

@@ -20,6 +20,7 @@ tokio = { version = "1.51.0", features = ["full"] }
tracing = "0.1.44" tracing = "0.1.44"
tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } tracing-subscriber = { version = "0.3.23", features = ["env-filter"] }
xdg = "3.0.0" xdg = "3.0.0"
tikv-jemallocator = "0.6"
[dependencies.slint] [dependencies.slint]
version = "1.16.1" version = "1.16.1"

View File

@@ -16,6 +16,10 @@ use crate::{
ui::{AppWindow, ImageBucket}, ui::{AppWindow, ImageBucket},
}; };
/// Use jemalloc to reduce memory fragmentation.
#[global_allocator]
static ALLOCATOR: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
mod api; mod api;
pub mod cachemap; pub mod cachemap;
mod thumbhash; mod thumbhash;