diff --git a/Cargo.lock b/Cargo.lock index 3c20ace..7d72aff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1744,6 +1744,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "libmimalloc-sys" +version = "0.1.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23aa6811d3bd4deb8a84dde645f943476d13b248d818edcf8ce0b2f37f036b44" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "librespot-audio" version = "0.6.0" @@ -1979,6 +1989,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "mimalloc" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68914350ae34959d83f732418d51e2427a794055d0b9529f48259ac07af65633" +dependencies = [ + "libmimalloc-sys", +] + [[package]] name = "mime" version = "0.3.17" @@ -2579,6 +2598,7 @@ dependencies = [ "librespot-discovery", "librespot-metadata", "librespot-playback", + "mimalloc", "poise", "pretty_assertions", "reqwest", diff --git a/Cargo.toml b/Cargo.toml index 3efe8f5..b9856b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,6 +16,7 @@ lto = "thin" anyhow = "1" dotenv = "0.15" futures = "0.3" +mimalloc = { version = "*" } rusqlite = { version = "0.33", features = ["bundled"] } smallvec = { version = "1", features = ["union"] } tokio = { version = "1", features = ["rt-multi-thread"] } diff --git a/src/main.rs b/src/main.rs index c823112..d27ba10 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,6 +16,9 @@ mod storage; mod track_info; mod yt_dlp; +#[global_allocator] +static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; + struct Data { yt_dlp_resolver: yt_dlp::Resolver, radio_t_resolver: radiot::Resolver,