reth_cli_util/
allocator.rscfg_if::cfg_if! {
if #[cfg(all(feature = "jemalloc", unix))] {
type AllocatorInner = tikv_jemallocator::Jemalloc;
} else if #[cfg(all(feature = "snmalloc", unix))] {
type AllocatorInner = snmalloc_rs::SnMalloc;
} else {
type AllocatorInner = std::alloc::System;
}
}
cfg_if::cfg_if! {
if #[cfg(all(feature = "snmalloc", feature = "jemalloc", unix))] {
use snmalloc_rs as _;
}
}
cfg_if::cfg_if! {
if #[cfg(feature = "tracy-allocator")] {
type AllocatorWrapper = tracy_client::ProfiledAllocator<AllocatorInner>;
tracy_client::register_demangler!();
const fn new_allocator_wrapper() -> AllocatorWrapper {
AllocatorWrapper::new(AllocatorInner {}, 100)
}
} else {
type AllocatorWrapper = AllocatorInner;
const fn new_allocator_wrapper() -> AllocatorWrapper {
AllocatorInner {}
}
}
}
pub type Allocator = AllocatorWrapper;
pub const fn new_allocator() -> Allocator {
new_allocator_wrapper()
}