Skip to content

Commit

Permalink
Merge pull request #7 from satler-git/custom-alloc
Browse files Browse the repository at this point in the history
  • Loading branch information
satler-git authored Nov 25, 2024
2 parents 70b7b40 + f3b8349 commit c166bd3
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 22 deletions.
85 changes: 63 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crates/etymora/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,13 @@ thiserror.workspace = true
tracing.workspace = true
tracing-subscriber = "0.3.18"

jemallocator = { version = "0.5.4", optional = true }
mimalloc = { version = "0.1.43", optional = true }

[build-dependencies]
shadow-rs = "0.36.0"

[features]
default = []
mimalloc = ["dep:mimalloc"]
jemalloc = ["dep:jemallocator"]
8 changes: 8 additions & 0 deletions crates/etymora/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ use tracing::{info, Level};
use std::error::Error;
use std::time::Duration;

#[cfg(feature = "mimalloc")]
#[global_allocator]
static ALLOC: mimalloc::MiMalloc = mimalloc::MiMalloc;

#[cfg(all(feature = "jemalloc", not(target_env = "msvc")))]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

shadow!(build);

#[derive(Parser, Debug)]
Expand Down

0 comments on commit c166bd3

Please sign in to comment.