pub struct TurboMalloc;Expand description
Turbo’s preferred global allocator. This is a new type instead of a type alias because you can’t use type aliases to instantiate unit types (E0423).
Implementations§
Source§impl TurboMalloc
impl TurboMalloc
pub fn memory_usage() -> usize
pub fn thread_stop()
pub fn thread_park()
pub fn allocation_counters() -> AllocationCounters
pub fn reset_allocation_counters(start: AllocationCounters)
Sourcepub fn memory_pressure() -> Option<u8>
pub fn memory_pressure() -> Option<u8>
Returns a memory pressure value in the range 0..=100, or None when
the current platform does not expose a memory pressure signal or a
query for it failed.
0 means no memory pressure, 100 means maximum pressure.
- On Linux this is derived from
/proc/pressure/memory(thesomeavg10stall percentage), falling back to(MemTotal - MemAvailable) / MemTotalfrom/proc/meminfowhen PSI is not available (older kernels, noCONFIG_PSI, or containers without access). - On macOS this is derived from the
kern.memorystatus_levelsysctl (100 - free_memory_percentage). - On Windows this is
MEMORYSTATUSEX::dwMemoryLoad(percentage of physical memory in use). - On other platforms this returns
None.
Trait Implementations§
Source§impl GlobalAlloc for TurboMalloc
impl GlobalAlloc for TurboMalloc
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl Freeze for TurboMalloc
impl RefUnwindSafe for TurboMalloc
impl Send for TurboMalloc
impl Sync for TurboMalloc
impl Unpin for TurboMalloc
impl UnsafeUnpin for TurboMalloc
impl UnwindSafe for TurboMalloc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more