Skip to content

Commit

Permalink
feat: use jemalloc as the default allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed Apr 30, 2024
1 parent 161b31b commit ec40fae
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Cargo.lock

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

4 changes: 4 additions & 0 deletions capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ name = "yara_x_capi"
crate-type = ["staticlib", "cdylib"]

[dependencies]

[target.'cfg(all(not(windows), not(target_env = "musl")))'.dependencies]
jemallocator = "0.5.4"

yara-x = { workspace = true }

[build-dependencies]
Expand Down
4 changes: 4 additions & 0 deletions capi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ thread_local! {
static LAST_ERROR: RefCell<Option<CString>> = RefCell::new(None);
}

#[cfg(all(not(windows), not(target_env = "musl")))]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

#[repr(C)]
pub enum YRX_RESULT {
/// Everything was OK.
Expand Down

0 comments on commit ec40fae

Please sign in to comment.