mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-27 20:58:56 -05:00
build releases with mimalloc
This commit is contained in:
@@ -9,6 +9,7 @@ publish = false
|
||||
rust-version = "1.82"
|
||||
|
||||
[features]
|
||||
mimalloc = ["dep:libmimalloc-sys"]
|
||||
nightly = []
|
||||
|
||||
[lib]
|
||||
@@ -16,10 +17,14 @@ path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
ahash = "0.8"
|
||||
coded = { git = "https://github.com/scottlamb/coded", rev = "2c97994974a73243d5dd12134831814f42cdb0e8"}
|
||||
coded = { git = "https://github.com/scottlamb/coded", rev = "2c97994974a73243d5dd12134831814f42cdb0e8" }
|
||||
futures = "0.3"
|
||||
jiff = { workspace = true }
|
||||
libc = "0.2"
|
||||
libmimalloc-sys = { version = "0.1.41", features = [
|
||||
"override",
|
||||
"extended",
|
||||
], optional = true }
|
||||
nix = { workspace = true, features = ["time"] }
|
||||
nom = "7.0.0"
|
||||
rusqlite = { workspace = true }
|
||||
|
||||
@@ -75,3 +75,16 @@ impl std::ops::Deref for Condvar {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ensure_malloc_used() {
|
||||
#[cfg(feature = "mimalloc")]
|
||||
{
|
||||
// This is a load-bearing debug line.
|
||||
// Building `libmimalloc-sys` with the `override` feature will override `malloc` and
|
||||
// `free` as used through the Rust global allocator, SQLite, and `libc`. But...`cargo`
|
||||
// doesn't seem to build `libmimalloc-sys` at all if it's not referenced from Rust code.
|
||||
tracing::debug!("mimalloc version {}", unsafe {
|
||||
libmimalloc_sys::mi_version()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user