pub struct MemoryTypePoolAllocator<Allocator: ComposableAllocator> { /* private fields */ }
Implementations§
source§impl<Allocator: ComposableAllocator> MemoryTypePoolAllocator<Allocator>
impl<Allocator: ComposableAllocator> MemoryTypePoolAllocator<Allocator>
sourcepub fn new(
memory_type_index: usize,
chunk_size: u64,
page_size: u64,
allocator: Allocator
) -> Self
pub fn new( memory_type_index: usize, chunk_size: u64, page_size: u64, allocator: Allocator ) -> Self
Create a new pool for a particular memory type index.
Params
- memory_type_index: the index of the specific memory type this pool can allocate from.
- chunk_size: the size of each chunk of memory to be divided into pages.
- page_size: chunks are divided into pages with this size for allocation.
- allocator: the backing allocator which provides device memory.
Trait Implementations§
source§impl<Allocator: ComposableAllocator> ComposableAllocator for MemoryTypePoolAllocator<Allocator>
impl<Allocator: ComposableAllocator> ComposableAllocator for MemoryTypePoolAllocator<Allocator>
source§unsafe fn allocate(
&mut self,
allocation_requirements: AllocationRequirements
) -> Result<Allocation, AllocatorError>
unsafe fn allocate( &mut self, allocation_requirements: AllocationRequirements ) -> Result<Allocation, AllocatorError>
Allocate GPU memory based on the given requirements. Read more
source§unsafe fn free(&mut self, allocation: Allocation)
unsafe fn free(&mut self, allocation: Allocation)
Return a GPU memory allocation to the device. Read more