Use mimalloc as the global allocator

This commit is contained in:
Loïc Lecrenier 2022-08-23 12:58:10 +02:00
parent ea365126b4
commit e659c08ac4
3 changed files with 21 additions and 27 deletions

41
Cargo.lock generated
View File

@ -1729,6 +1729,15 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db"
[[package]]
name = "libmimalloc-sys"
version = "0.1.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "11ca136052550448f55df7898c6dbe651c6b574fe38a0d9ea687a9f8088a2e2c"
dependencies = [
"cc",
]
[[package]]
name = "libz-sys"
version = "1.1.8"
@ -2055,6 +2064,7 @@ dependencies = [
"meilisearch-auth",
"meilisearch-lib",
"meilisearch-types",
"mimalloc",
"mime",
"num_cpus",
"obkv",
@ -2082,7 +2092,6 @@ dependencies = [
"tar",
"tempfile",
"thiserror",
"tikv-jemallocator",
"time 0.3.9",
"tokio",
"tokio-stream",
@ -2237,6 +2246,15 @@ dependencies = [
"uuid",
]
[[package]]
name = "mimalloc"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2f64ad83c969af2e732e907564deb0d0ed393cec4af80776f77dd77a1a427698"
dependencies = [
"libmimalloc-sys",
]
[[package]]
name = "mime"
version = "0.3.16"
@ -3438,27 +3456,6 @@ dependencies = [
"syn 1.0.96",
]
[[package]]
name = "tikv-jemalloc-sys"
version = "0.4.3+5.2.1-patched.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1792ccb507d955b46af42c123ea8863668fae24d03721e40cad6a41773dbb49"
dependencies = [
"cc",
"fs_extra",
"libc",
]
[[package]]
name = "tikv-jemallocator"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5b7bcecfafe4998587d636f9ae9d55eb9d0499877b88757767c346875067098"
dependencies = [
"libc",
"tikv-jemalloc-sys",
]
[[package]]
name = "time"
version = "0.1.43"

View File

@ -47,6 +47,7 @@ log = "0.4.14"
meilisearch-auth = { path = "../meilisearch-auth" }
meilisearch-types = { path = "../meilisearch-types" }
meilisearch-lib = { path = "../meilisearch-lib" }
mimalloc = { version = "0.1.29", default-features = false }
mime = "0.3.16"
num_cpus = "1.13.1"
obkv = "0.2.0"
@ -103,9 +104,6 @@ mini-dashboard = [
"zip",
]
[target.'cfg(target_os = "linux")'.dependencies]
tikv-jemallocator = "0.4.3"
[package.metadata.mini-dashboard]
assets-url = "https://github.com/meilisearch/mini-dashboard/releases/download/v0.2.1/build.zip"
sha1 = "05a02ff13c3982091884a3f81d28bf53e72607b2"

View File

@ -10,9 +10,8 @@ use meilisearch_http::analytics::Analytics;
use meilisearch_http::{create_app, setup_meilisearch, Opt};
use meilisearch_lib::MeiliSearch;
#[cfg(target_os = "linux")]
#[global_allocator]
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;
/// does all the setup before meilisearch is launched
fn setup(opt: &Opt) -> anyhow::Result<()> {