mirror of
https://github.com/girlbossceo/jemallocator.git
synced 2024-12-01 16:16:16 +00:00
17 lines
412 B
Rust
17 lines
412 B
Rust
extern crate jemallocator;
|
|
extern crate jemalloc_sys;
|
|
|
|
// Work around https://github.com/alexcrichton/jemallocator/issues/19
|
|
#[global_allocator]
|
|
static A: jemallocator::Jemalloc = jemallocator::Jemalloc;
|
|
|
|
#[test]
|
|
fn smoke() {
|
|
unsafe {
|
|
let ptr = jemalloc_sys::malloc(4);
|
|
*(ptr as *mut u32) = 0xDECADE;
|
|
assert_eq!(*(ptr as *mut u32), 0xDECADE);
|
|
jemalloc_sys::free(ptr);
|
|
}
|
|
}
|