Skip to content

Commit

Permalink
Only enable dhat dependency if feature is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
chipshort committed Jan 16, 2024
1 parent fceaad5 commit 1e4b862
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 6 additions & 4 deletions packages/vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ staking = ["cosmwasm-std/staking"]
stargate = ["cosmwasm-std/stargate"]
# Use cranelift backend instead of singlepass. This is required for development on Windows.
cranelift = ["wasmer/cranelift"]
# For heap profiling. Used in examples.
dhat-heap = []
# For heap profiling. Only used in "memory" example.
dhat-heap = ["dep:dhat"]

[lib]
# See https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
Expand All @@ -45,6 +45,9 @@ thiserror = "1.0.26"
wasmer = { version = "=4.2.5", default-features = false, features = ["cranelift", "singlepass"] }
wasmer-middlewares = "=4.2.5"
strum = { version = "0.25.0", default-features = false, features = ["derive"] }
# For heap profiling. Only used in "memory" example. This has to be a non-dev dependency
# because cargo currently does not support optional dev-dependencies.
dhat = { version = "0.3.2", optional = true }

# Dependencies that we do not use ourself. We add those entries
# to bump the min version of them.
Expand All @@ -67,7 +70,6 @@ clap = "4"
rand = "0.8"
leb128 = "0.2"
target-lexicon = "0.12"
dhat = "0.3.2"
time = { version = "0.3.28", features = ["formatting"] }

[[bench]]
Expand All @@ -77,7 +79,7 @@ harness = false
[[example]]
name = "memory"
path = "examples/memory.rs"
required-features = []
required-features = ["dhat-heap"]

[profile.release]
debug = 1
1 change: 0 additions & 1 deletion packages/vm/examples/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use cosmwasm_vm::{
Size,
};

#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;

Expand Down

0 comments on commit 1e4b862

Please sign in to comment.