rspack_allocator/
lib.rs

1#[global_allocator]
2#[cfg(not(any(miri, target_family = "wasm")))]
3#[cfg(not(any(feature = "sftrace-setup", feature = "tracy-client")))]
4static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
5
6#[global_allocator]
7#[cfg(not(any(miri, target_family = "wasm")))]
8#[cfg(feature = "sftrace-setup")]
9static GLOBAL: sftrace_setup::SftraceAllocator<mimalloc::MiMalloc> =
10  sftrace_setup::SftraceAllocator(mimalloc::MiMalloc);
11
12#[global_allocator]
13#[cfg(not(any(miri, target_family = "wasm")))]
14#[cfg(all(feature = "tracy-client", not(feature = "sftrace-setup")))]
15static GLOBAL: tracy_client::ProfiledAllocator<std::alloc::System> =
16  tracy_client::ProfiledAllocator::new(std::alloc::System, 10); // adjust callstack_depth if needed with performance cost