summaryrefslogtreecommitdiff
path: root/src/rust/smartlist/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/rust/smartlist/lib.rs')
-rw-r--r--src/rust/smartlist/lib.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rust/smartlist/lib.rs b/src/rust/smartlist/lib.rs
index 2716842af2..34d0b907ed 100644
--- a/src/rust/smartlist/lib.rs
+++ b/src/rust/smartlist/lib.rs
@@ -6,3 +6,12 @@ extern crate libc;
mod smartlist;
pub use smartlist::*;
+
+// When testing we may be compiled with sanitizers which are incompatible with
+// Rust's default allocator, jemalloc (unsure why at this time). Most crates
+// link to `tor_allocate` which switches by default to a non-jemalloc allocator,
+// but we don't already depend on `tor_allocate` so make sure that while testing
+// we don't use jemalloc. (but rather malloc/free)
+#[global_allocator]
+#[cfg(test)]
+static A: std::alloc::System = std::alloc::System;