pub struct ZoneAllocator<'a> { /* private fields */ }
Expand description

A zone allocator for arbitrary sized allocations.

Has a bunch of SCAllocator and through that can serve allocation requests for many different object sizes up to (MAX_SIZE_CLASSES) by selecting the right SCAllocator for allocation and deallocation.

The allocator provides to refill functions refill and refill_large to provide the underlying SCAllocator with more memory in case it runs out.

Implementations

Maximum size that allocated within LargeObjectPages (2 MiB). This is also the maximum object size that this allocator can handle.

Maximum size which is allocated with ObjectPages (4 KiB pages).

e.g. this is 4 KiB - 80 bytes of meta-data.

Return maximum size an object of size current_size can use.

Used to optimize realloc.

Reclaims empty pages by calling dealloc on it and removing it from the empty lists in the SCAllocator.

The dealloc function is called at most reclaim_base_max times for base pages, and at most reclaim_large_max for large pages.

Reclaims empty pages by calling dealloc on it and removing it from the empty lists in the SCAllocator.

The dealloc function is called at most reclaim_base_max times for base pages, and at most reclaim_large_max for large pages.

Trait Implementations

Allocate a pointer to a block of memory described by layout.

Deallocates a pointer to a block of memory, which was previously allocated by allocate.

Arguments
  • ptr - Address of the memory location to free.
  • layout - Memory layout of the block pointed to by ptr.

Refills the SCAllocator for a given Layout with an ObjectPage.

Safety

ObjectPage needs to be emtpy etc.

Refills the SCAllocator for a given Layout with an ObjectPage.

Safety

ObjectPage needs to be emtpy etc.

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.