Trait SubAllocator
Source pub(crate) trait SubAllocator:
SubAllocatorBase
+ Debug
+ Sync
+ Send {
// Required methods
fn allocate(
&mut self,
size: u64,
alignment: u64,
allocation_type: AllocationType,
granularity: u64,
name: &str,
) -> Result<(u64, NonZeroU64)>;
fn free(&mut self, chunk_id: Option<NonZeroU64>) -> Result<()>;
fn rename_allocation(
&mut self,
chunk_id: Option<NonZeroU64>,
name: &str,
) -> Result<()>;
fn report_memory_leaks(
&self,
log_level: Level,
memory_type_index: usize,
memory_block_index: usize,
);
fn report_allocations(&self) -> Vec<AllocationReport>;
fn supports_general_allocations(&self) -> bool;
fn allocated(&self) -> u64;
// Provided method
fn is_empty(&self) -> bool { ... }
}
Returns true if this allocator allows sub-allocating multiple allocations, false if
it is designed to only represent dedicated allocations.
Helper function: reports if the suballocator is empty (meaning, having no allocations).