pub struct StandardPolicy;Expand description
Zero-Sized Type (ZST) representing the standard allocation policy with maximum performance.
All flags are false; every policy-guarded branch is dead code and is
eliminated at compile time. StandardPolicy allocations and frees pay no
poisoning or zeroing cost.
Trait Implementations§
Source§impl AllocPolicy for StandardPolicy
impl AllocPolicy for StandardPolicy
Source§const SEGMENT_POOL_WARM_THRESHOLD: usize = 4
const SEGMENT_POOL_WARM_THRESHOLD: usize = 4
Keep 4 committed free segments warm for rapid free-then-allocate bursts.
Source§const ENABLE_POISONING: bool = false
const ENABLE_POISONING: bool = false
If true, write poison bytes to memory on allocation and deallocation to
detect heap corruption.
Source§const ZERO_INITIALIZE: bool = false
const ZERO_INITIALIZE: bool = false
If true, zero-initialize all memory allocations.
Source§const POLICY_NAME: &'static str = "standard"
const POLICY_NAME: &'static str = "standard"
Human-readable name for this policy. Zero-cost — inlined by the compiler.
Source§const MITIGATION_FLAGS: u32 = mitigations::NONE
const MITIGATION_FLAGS: u32 = mitigations::NONE
Combined bitmask of active
mitigations for this
policy.Source§const POISON_FREE_BYTE: u8 = 0xDE
const POISON_FREE_BYTE: u8 = 0xDE
Byte pattern to write into memory when it is freed.
Source§const POISON_ALLOC_BYTE: u8 = 0xAD
const POISON_ALLOC_BYTE: u8 = 0xAD
Byte pattern to write into memory when it is allocated.
Source§const ENABLE_FREE_LIST_ENCRYPTION: bool = false
const ENABLE_FREE_LIST_ENCRYPTION: bool = false
If true, encrypt free list next pointers using the per-segment XOR key.
Source§const RANDOMIZE_ALLOCATION: bool = false
const RANDOMIZE_ALLOCATION: bool = false
If true, randomize the allocation order of blocks in a page.
Source§const DELAY_PAGE_WAKE: bool = false
const DELAY_PAGE_WAKE: bool = false
If true, a full page does not become active until at least
capacity / WAKE_DENOMINATOR blocks are freed from it.Source§const WAKE_DENOMINATOR: u16 = 4
const WAKE_DENOMINATOR: u16 = 4
Denominator for the page-wake hysteresis.
Source§const GWP_SAMPLE_RATE: u32 = 0
const GWP_SAMPLE_RATE: u32 = 0
Probabilistic guard-page sampling rate (GWP-ASan hook).
0 disables. Inspired by snmalloc 0.7.2 gwp_asan.h.Source§const MAX_ALLOC_SIZE_LIMIT: usize = 0
const MAX_ALLOC_SIZE_LIMIT: usize = 0
Maximum allocation size this policy will serve without a panic/error. Read more
Source§const POLICY_FINGERPRINT: u64 = _
const POLICY_FINGERPRINT: u64 = _
Compile-time configuration fingerprint. Read more
Source§impl Clone for StandardPolicy
impl Clone for StandardPolicy
Source§fn clone(&self) -> StandardPolicy
fn clone(&self) -> StandardPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for StandardPolicy
Source§impl Debug for StandardPolicy
impl Debug for StandardPolicy
Source§impl Default for StandardPolicy
impl Default for StandardPolicy
Source§fn default() -> StandardPolicy
fn default() -> StandardPolicy
Returns the “default value” for a type. Read more
impl Eq for StandardPolicy
Source§impl PartialEq for StandardPolicy
impl PartialEq for StandardPolicy
Source§impl PolicySlotSelection<CudaDeviceBackend> for StandardPolicy
impl PolicySlotSelection<CudaDeviceBackend> for StandardPolicy
Source§fn with_allocator<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaDeviceBackend>) -> R,
) -> Option<R>
fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaDeviceBackend>) -> R, ) -> Option<R>
Runs
f with access to the allocator cache selected for this policy.Source§unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaDeviceBackend>) -> R,
) -> Option<R>
unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaDeviceBackend>) -> R, ) -> Option<R>
Runs
f with access to the selected policy cache without arming the
re-entrancy gate. Read moreSource§fn get_allocator_ptr() -> *mut c_void
fn get_allocator_ptr() -> *mut c_void
Returns the initialized allocator pointer for this policy’s TLS slot.
Source§fn get_allocator_ptr_raw() -> *mut c_void
fn get_allocator_ptr_raw() -> *mut c_void
Returns the raw allocator pointer for this policy’s TLS slot without
forcing lazy initialization.
Source§impl PolicySlotSelection<CudaGddrBackend> for StandardPolicy
impl PolicySlotSelection<CudaGddrBackend> for StandardPolicy
Source§fn with_allocator<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaGddrBackend>) -> R,
) -> Option<R>
fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaGddrBackend>) -> R, ) -> Option<R>
Runs
f with access to the allocator cache selected for this policy.Source§unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaGddrBackend>) -> R,
) -> Option<R>
unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaGddrBackend>) -> R, ) -> Option<R>
Runs
f with access to the selected policy cache without arming the
re-entrancy gate. Read moreSource§fn get_allocator_ptr() -> *mut c_void
fn get_allocator_ptr() -> *mut c_void
Returns the initialized allocator pointer for this policy’s TLS slot.
Source§fn get_allocator_ptr_raw() -> *mut c_void
fn get_allocator_ptr_raw() -> *mut c_void
Returns the raw allocator pointer for this policy’s TLS slot without
forcing lazy initialization.
Source§impl PolicySlotSelection<CudaHbmBackend> for StandardPolicy
impl PolicySlotSelection<CudaHbmBackend> for StandardPolicy
Source§fn with_allocator<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaHbmBackend>) -> R,
) -> Option<R>
fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHbmBackend>) -> R, ) -> Option<R>
Runs
f with access to the allocator cache selected for this policy.Source§unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaHbmBackend>) -> R,
) -> Option<R>
unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHbmBackend>) -> R, ) -> Option<R>
Runs
f with access to the selected policy cache without arming the
re-entrancy gate. Read moreSource§fn get_allocator_ptr() -> *mut c_void
fn get_allocator_ptr() -> *mut c_void
Returns the initialized allocator pointer for this policy’s TLS slot.
Source§fn get_allocator_ptr_raw() -> *mut c_void
fn get_allocator_ptr_raw() -> *mut c_void
Returns the raw allocator pointer for this policy’s TLS slot without
forcing lazy initialization.
Source§impl PolicySlotSelection<CudaHostPinnedBackend> for StandardPolicy
impl PolicySlotSelection<CudaHostPinnedBackend> for StandardPolicy
Source§fn with_allocator<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaHostPinnedBackend>) -> R,
) -> Option<R>
fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHostPinnedBackend>) -> R, ) -> Option<R>
Runs
f with access to the allocator cache selected for this policy.Source§unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaHostPinnedBackend>) -> R,
) -> Option<R>
unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaHostPinnedBackend>) -> R, ) -> Option<R>
Runs
f with access to the selected policy cache without arming the
re-entrancy gate. Read moreSource§fn get_allocator_ptr() -> *mut c_void
fn get_allocator_ptr() -> *mut c_void
Returns the initialized allocator pointer for this policy’s TLS slot.
Source§fn get_allocator_ptr_raw() -> *mut c_void
fn get_allocator_ptr_raw() -> *mut c_void
Returns the raw allocator pointer for this policy’s TLS slot without
forcing lazy initialization.
Source§impl PolicySlotSelection<CudaUnifiedBackend> for StandardPolicy
impl PolicySlotSelection<CudaUnifiedBackend> for StandardPolicy
Source§fn with_allocator<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaUnifiedBackend>) -> R,
) -> Option<R>
fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<CudaUnifiedBackend>) -> R, ) -> Option<R>
Runs
f with access to the allocator cache selected for this policy.Source§unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<CudaUnifiedBackend>) -> R,
) -> Option<R>
unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<CudaUnifiedBackend>) -> R, ) -> Option<R>
Runs
f with access to the selected policy cache without arming the
re-entrancy gate. Read moreSource§fn get_allocator_ptr() -> *mut c_void
fn get_allocator_ptr() -> *mut c_void
Returns the initialized allocator pointer for this policy’s TLS slot.
Source§fn get_allocator_ptr_raw() -> *mut c_void
fn get_allocator_ptr_raw() -> *mut c_void
Returns the raw allocator pointer for this policy’s TLS slot without
forcing lazy initialization.
Source§impl PolicySlotSelection<MemoryBackendWrapper> for StandardPolicy
impl PolicySlotSelection<MemoryBackendWrapper> for StandardPolicy
Source§fn with_allocator<R>(
f: impl FnOnce(&mut ThreadAllocator<MemoryBackendWrapper>) -> R,
) -> Option<R>
fn with_allocator<R>( f: impl FnOnce(&mut ThreadAllocator<MemoryBackendWrapper>) -> R, ) -> Option<R>
Runs
f with access to the allocator cache selected for this policy.Source§unsafe fn with_allocator_unguarded<R>(
f: impl FnOnce(&mut ThreadAllocator<MemoryBackendWrapper>) -> R,
) -> Option<R>
unsafe fn with_allocator_unguarded<R>( f: impl FnOnce(&mut ThreadAllocator<MemoryBackendWrapper>) -> R, ) -> Option<R>
Runs
f with access to the selected policy cache without arming the
re-entrancy gate. Read moreSource§fn get_allocator_ptr() -> *mut c_void
fn get_allocator_ptr() -> *mut c_void
Returns the initialized allocator pointer for this policy’s TLS slot.
Source§fn get_allocator_ptr_raw() -> *mut c_void
fn get_allocator_ptr_raw() -> *mut c_void
Returns the raw allocator pointer for this policy’s TLS slot without
forcing lazy initialization.
impl StructuralPartialEq for StandardPolicy
Auto Trait Implementations§
impl Freeze for StandardPolicy
impl RefUnwindSafe for StandardPolicy
impl Send for StandardPolicy
impl Sync for StandardPolicy
impl Unpin for StandardPolicy
impl UnsafeUnpin for StandardPolicy
impl UnwindSafe for StandardPolicy
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