Trait method lrs::alloc::Allocator::free

Frees an object.

Syntax

unsafe fn free<T>(pool: &mut <Self as Allocator>::Pool, ptr: *mut T) -> ()

Arguments

NameDescription
pool

The pool to which the memory is returned.

ptr

The pointer to the object.

Remarks

If T has size 0, this function performs no operation. Otherwise:

The pointer argument must be a pointer returned by a previous call to allocate with the same allocator and pool. Otherwise the behavior is undefined.

After this function returns the pointer argument becomes invalid and must no longer be used.