Skip to content

Commit ca74252

Browse files
authored
Merge pull request purpleprotocol#72 from EmbarkStudios/expose-debug-feature
Expose mimalloc's debug mode with a "debug" cargo feature
2 parents 409dba5 + cdf36c5 commit ca74252

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,5 @@ libmimalloc-sys = { path = "libmimalloc-sys", version = "0.1.22", default-featur
2727
default = ["secure"]
2828
secure = ["libmimalloc-sys/secure"]
2929
override = ["libmimalloc-sys/override"]
30+
debug = ["libmimalloc-sys/debug"]
3031
local_dynamic_tls = ["libmimalloc-sys/local_dynamic_tls"]

libmimalloc-sys/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ cc = "1.0"
1818

1919
[features]
2020
secure = []
21+
debug = []
2122
override = []
2223
extended = ["cty"]
2324
local_dynamic_tls = []

libmimalloc-sys/build.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ fn main() {
3232
}
3333
}
3434

35-
// Remove heavy debug assertions etc
36-
build.define("MI_DEBUG", "0");
35+
if env::var_os("CARGO_FEATURE_DEBUG").is_some() {
36+
build.define("MI_DEBUG", "3");
37+
build.define("MI_SHOW_ERRORS", "1");
38+
} else {
39+
// Remove heavy debug assertions etc
40+
build.define("MI_DEBUG", "0");
41+
}
3742

3843
if build.get_compiler().is_like_msvc() {
3944
build.cpp(true);

0 commit comments

Comments
 (0)