Crate page_allocator
source ·Expand description
Provides an allocator for virtual memory pages. The minimum unit of allocation is a single page.
This also supports early allocation of pages (up to 32 separate chunks) before heap allocation is available, and does so behind the scenes using the same single interface.
Once heap allocation is available, it uses a dynamically-allocated list of page chunks to track allocations.
The core allocation function is allocate_pages_deferred()
,
but there are several convenience functions that offer simpler interfaces for general usage.
Notes and Missing Features
This allocator currently does not merge freed chunks (de-fragmentation) upon deallocation. It only merges free chunks lazily upon request, i.e., when we run out of address space or when a requested address is in a chunk that needs to be merged with a nearby chunk.
Structs
VirtualAddress
es, specified in Page
s. Functions
VirtualAddress
.VirtualAddress
with a size given in number of bytes. allocated_pages_deferred()
,
but accepts a size value for the allocated pages in number of bytes instead of number of pages. VirtualAddress
.