Skip to main content

SubAllocator

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 { ... }
}

Required Methods§

Source

fn allocate( &mut self, size: u64, alignment: u64, allocation_type: AllocationType, granularity: u64, name: &str, ) -> Result<(u64, NonZeroU64)>

Source

fn free(&mut self, chunk_id: Option<NonZeroU64>) -> Result<()>

Source

fn rename_allocation( &mut self, chunk_id: Option<NonZeroU64>, name: &str, ) -> Result<()>

Source

fn report_memory_leaks( &self, log_level: Level, memory_type_index: usize, memory_block_index: usize, )

Source

fn report_allocations(&self) -> Vec<AllocationReport>

Source

fn supports_general_allocations(&self) -> bool

Returns true if this allocator allows sub-allocating multiple allocations, false if it is designed to only represent dedicated allocations.

Source

fn allocated(&self) -> u64

Provided Methods§

Source

fn is_empty(&self) -> bool

Helper function: reports if the suballocator is empty (meaning, having no allocations).

Implementors§