Struct gpu_alloc::freelist::FreeListAllocator
source · pub(crate) struct FreeListAllocator<M> {
freelist: FreeList<M>,
chunk_size: u64,
final_chunk_size: u64,
memory_type: u32,
props: MemoryPropertyFlags,
atom_mask: u64,
total_allocations: u64,
total_deallocations: u64,
}
Fields§
§freelist: FreeList<M>
§chunk_size: u64
§final_chunk_size: u64
§memory_type: u32
§props: MemoryPropertyFlags
§atom_mask: u64
§total_allocations: u64
§total_deallocations: u64
Implementations§
source§impl<M> FreeListAllocator<M>where
M: MemoryBounds + 'static,
impl<M> FreeListAllocator<M>where
M: MemoryBounds + 'static,
pub fn new( starting_chunk_size: u64, final_chunk_size: u64, memory_type: u32, props: MemoryPropertyFlags, atom_mask: u64, ) -> Self
pub unsafe fn alloc( &mut self, device: &impl MemoryDevice<M>, size: u64, align_mask: u64, flags: AllocationFlags, heap: &mut Heap, allocations_remains: &mut u32, ) -> Result<FreeListBlock<M>, AllocationError>
pub unsafe fn dealloc( &mut self, device: &impl MemoryDevice<M>, block: FreeListBlock<M>, heap: &mut Heap, allocations_remains: &mut u32, )
sourcepub unsafe fn cleanup(
&mut self,
device: &impl MemoryDevice<M>,
heap: &mut Heap,
allocations_remains: &mut u32,
)
pub unsafe fn cleanup( &mut self, device: &impl MemoryDevice<M>, heap: &mut Heap, allocations_remains: &mut u32, )
Deallocates leftover memory objects. Should be used before dropping.
§Safety
device
must be one withDeviceProperties
that were provided to create thisGpuAllocator
instance- Same
device
instance must be used for all interactions with oneGpuAllocator
instance and memory blocks allocated from it
fn host_visible(&self) -> bool
Trait Implementations§
source§impl<M: Debug> Debug for FreeListAllocator<M>
impl<M: Debug> Debug for FreeListAllocator<M>
Auto Trait Implementations§
impl<M> Freeze for FreeListAllocator<M>
impl<M> RefUnwindSafe for FreeListAllocator<M>where
M: RefUnwindSafe,
impl<M> Send for FreeListAllocator<M>where
M: Send,
impl<M> Sync for FreeListAllocator<M>where
M: Sync,
impl<M> Unpin for FreeListAllocator<M>
impl<M> UnwindSafe for FreeListAllocator<M>where
M: RefUnwindSafe,
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