Skip to content

Commit

Permalink
Merge pull request #72 from EmbarkStudios/expose-debug-feature
Browse files Browse the repository at this point in the history
Expose mimalloc's debug mode with a "debug" cargo feature
  • Loading branch information
octavonce authored Oct 29, 2021
2 parents 409dba5 + cdf36c5 commit ca74252
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ libmimalloc-sys = { path = "libmimalloc-sys", version = "0.1.22", default-featur
default = ["secure"]
secure = ["libmimalloc-sys/secure"]
override = ["libmimalloc-sys/override"]
debug = ["libmimalloc-sys/debug"]
local_dynamic_tls = ["libmimalloc-sys/local_dynamic_tls"]
1 change: 1 addition & 0 deletions libmimalloc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ cc = "1.0"

[features]
secure = []
debug = []
override = []
extended = ["cty"]
local_dynamic_tls = []
Expand Down
9 changes: 7 additions & 2 deletions libmimalloc-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ fn main() {
}
}

// Remove heavy debug assertions etc
build.define("MI_DEBUG", "0");
if env::var_os("CARGO_FEATURE_DEBUG").is_some() {
build.define("MI_DEBUG", "3");
build.define("MI_SHOW_ERRORS", "1");
} else {
// Remove heavy debug assertions etc
build.define("MI_DEBUG", "0");
}

if build.get_compiler().is_like_msvc() {
build.cpp(true);
Expand Down

0 comments on commit ca74252

Please sign in to comment.