Trait method lrs::alloc::Allocator::free_raw

Deallocates a chunk of bytes with the specified properties.

Syntax

unsafe fn free_raw(pool: &mut <Self as Allocator>::Pool, ptr: *mut u8, size: usize, alignment: usize) -> ()

Arguments

NameDescription
pool

The pool to which the memory is returned.

ptr

The pointer that should be deallocated.

size

The size of the allocation.

alignment

The alignment of the allocation.

Remarks

The pointer argument must have been returned by a previous invocation of allocate_raw or reallocate_raw with the same allocator and pool. The alignment argument must be the same alignment that was previously used to allocate the object. The size argument must be the current size of the object.

Otherwise the behavior is undefined.

This function always succeeds and the pointer argument must no longer be used after this call.