pub fn new(mem: MemoryRef) -> Self {
		let current_size: Bytes = mem.current_size().into();
		let current_size = current_size.0 as u32;
		let used_size = mem.used_size().0 as u32;
		let heap_size = current_size - used_size;

		let mut ptr_offset = used_size;
		let padding = ptr_offset % ALIGNMENT;
		if padding != 0 {
			ptr_offset += ALIGNMENT - padding;
		}

		FreeingBumpHeapAllocator {
			bumper: 0,
			heads: [0; N],
			heap: mem,
			max_heap_size: heap_size,
			ptr_offset: ptr_offset,
			total_size: 0,
		}
	}
/// Creates a new allocation heap which follows a freeing-bump strategy.
/// The maximum size which can be allocated at once is 16 MiB.
///
/// # Arguments
///
/// * `ptr_offset` - The pointers returned by `allocate()` start from this
///   offset on. The pointer offset needs to be aligned to a multiple of 8,
///   hence a padding might be added to align `ptr_offset` properly.
///
/// * `heap_size` - The size available to this heap instance (in bytes) for
///   allocating memory.
///
/// * `heap` - A `MemoryRef` to the available `MemoryInstance` which is
///   used as the heap.
///
Creates a new allocation heap which follows a freeing-bump strategy.
The maximum size which can be allocated at once is 16 MiB.
Creates a new allocation heap which follows a freeing - bump strategy . The maximum size which can be allocated at once is 16 MiB .
pub fn new(mem: MemoryRef) -> Self {
		let current_size: Bytes = mem.current_size().into();
		let current_size = current_size.0 as u32;
		let used_size = mem.used_size().0 as u32;
		let heap_size = current_size - used_size;
		let mut ptr_offset = used_size;
		let padding = ptr_offset % ALIGNMENT;
		if padding != 0 {
			ptr_offset += ALIGNMENT - padding;
		}
		FreeingBumpHeapAllocator {
			bumper: 0,
			heads: [0; N],
			heap: mem,
			max_heap_size: heap_size,
			ptr_offset: ptr_offset,
			total_size: 0,
		}
	}
pub fn new ( mem : MemoryRef ) -> Self { let current_size : Bytes = mem . current_size ( ) . into ( ) ; let current_size = current_size . 0 as u32 ; let used_size = mem . used_size ( ) . 0 as u32 ; let heap_size = current_size - used_size ; let mut ptr_offset = used_size ; let padding = ptr_offset % ALIGNMENT ; if padding != 0 { ptr_offset += ALIGNMENT - padding ; } FreeingBumpHeapAllocator { bumper : 0 , heads : [ 0 ; N ] , heap : mem , max_heap_size : heap_size , ptr_offset : ptr_offset , total_size : 0 , } }
Creates a new allocation heap which follows a freeing-bump strategy.
Creates a new allocation heap which follows a freeing - bump strategy .
mem
MemoryRef
mem
MemoryRef