Skip to content

Commit

Permalink
Move mimalloc feature to imageflow_helpers and fix conflict with syst…
Browse files Browse the repository at this point in the history
…em alloc
  • Loading branch information
lilith committed Jan 21, 2025
1 parent 25438a7 commit 15ac8fb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

3 changes: 0 additions & 3 deletions imageflow_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ evalchroma = "1"
libpng-sys = { version = "1.1.9", features = ["static", "static-libz", "libz-sys"] }


mimalloc = { version = "*", features = ["secure"], optional = true }

[dev-dependencies]
hyper = "1.4"
Expand All @@ -90,8 +89,6 @@ rand = "*"
default = []
nightly = []
c_rendering = []
mimalloc = ["dep:mimalloc"]

[[bench]]
name="bench_graphics"
path = "benches/bench_graphics.rs"
Expand Down
7 changes: 0 additions & 7 deletions imageflow_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,3 @@ pub mod for_other_imageflow_crates {
}
}
}

#[cfg(feature = "mimalloc")]
use mimalloc::MiMalloc;

#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
4 changes: 4 additions & 0 deletions imageflow_helpers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ unicase = "2"

backtrace = "0.3"

mimalloc = { version = "*", features = ["secure"], optional = true }


[dev-dependencies]
mockito = "*"

[features]
nightly = []
mimalloc = ["dep:mimalloc"]

8 changes: 8 additions & 0 deletions imageflow_helpers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,19 @@
// }
//}

#[cfg(not(feature = "mimalloc"))]
use std::alloc::System;
#[cfg(not(feature = "mimalloc"))]

#[global_allocator]
static GLOBAL: System = System;

#[cfg(feature = "mimalloc")]
use mimalloc::MiMalloc;

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

//#[macro_use]
//extern crate error_chain;
Expand Down

0 comments on commit 15ac8fb

Please sign in to comment.