reth_cli_util/
allocator.rs1cfg_if::cfg_if! {
9 if #[cfg(all(feature = "jemalloc", unix))] {
10 type AllocatorInner = tikv_jemallocator::Jemalloc;
11 } else if #[cfg(all(feature = "snmalloc", unix))] {
12 type AllocatorInner = snmalloc_rs::SnMalloc;
13 } else {
14 type AllocatorInner = std::alloc::System;
15 }
16}
17
18#[cfg(all(feature = "jemalloc", unix))]
21pub use tikv_jemalloc_sys;
22
23cfg_if::cfg_if! {
25 if #[cfg(all(feature = "snmalloc", feature = "jemalloc", unix))] {
26 use snmalloc_rs as _;
27 }
28}
29
30cfg_if::cfg_if! {
31 if #[cfg(feature = "tracy-allocator")] {
32 type AllocatorWrapper = tracy_client::ProfiledAllocator<AllocatorInner>;
33 const fn new_allocator_wrapper() -> AllocatorWrapper {
34 AllocatorWrapper::new(AllocatorInner {}, 100)
35 }
36 } else {
37 type AllocatorWrapper = AllocatorInner;
38 const fn new_allocator_wrapper() -> AllocatorWrapper {
39 AllocatorInner {}
40 }
41 }
42}
43
44pub type Allocator = AllocatorWrapper;
46
47pub const fn new_allocator() -> Allocator {
49 new_allocator_wrapper()
50}