diff --git a/.cspell.json b/.cspell.json index 74b3f21d..4c48af7d 100644 --- a/.cspell.json +++ b/.cspell.json @@ -14,6 +14,8 @@ "consts", "endianness", "Hasher", + "Jemalloc", + "jemallocator", "keypair", "kvstore", "linearizable", @@ -30,6 +32,7 @@ "Secp256k1", "seedable", "serde", + "tikv", "unreplicated", "upcall", "upcalls" diff --git a/Cargo.lock b/Cargo.lock index aa81c726..d1625520 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -441,6 +441,7 @@ dependencies = [ "serde", "serde_json", "sha2", + "tikv-jemallocator", "tokio", ] @@ -770,6 +771,26 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "tikv-jemalloc-sys" +version = "0.5.4+5.3.0-patched" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9402443cb8fd499b6f327e40565234ff34dbda27460c5b47db0db77443dd85d1" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "tikv-jemallocator" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "965fe0c26be5c56c94e38ba547249074803efd52adfb66de62107d95aab3eaca" +dependencies = [ + "libc", + "tikv-jemalloc-sys", +] + [[package]] name = "tokio" version = "1.38.0" diff --git a/Cargo.toml b/Cargo.toml index e081811c..f6365a79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,3 +21,6 @@ serde = { version = "1.0.203", features = ["derive"] } serde_json = "1.0.120" sha2 = "0.10.8" tokio = { version = "1.38.0", features = ["macros", "net", "rt", "signal", "sync", "time"] } + +[dev-dependencies] +tikv-jemallocator = "0.5.4" diff --git a/examples/unreplicated-check.rs b/examples/unreplicated-check.rs index 02ce5b69..75d769d8 100644 --- a/examples/unreplicated-check.rs +++ b/examples/unreplicated-check.rs @@ -16,6 +16,9 @@ use neatworks::{ }; use rand::thread_rng; +#[global_allocator] +static GLOBAL: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc; + fn main() -> anyhow::Result<()> { println!("* Single client; Put, Append, Get"); let mut state = State::new()?;