pub struct PagedArena { /* private fields */ }Expand description
A fixed-capacity page allocator with deterministic first-fit placement.
Implementations§
Source§impl PagedArena
impl PagedArena
Sourcepub fn new(page_size: u64, page_count: u32) -> Result<Self, ArenaError>
pub fn new(page_size: u64, page_count: u32) -> Result<Self, ArenaError>
Reserves all allocator metadata up front.
§Errors
Returns ArenaError::InvalidConfiguration for an empty arena.
Sourcepub fn allocate(&mut self, byte_len: u64) -> Result<ArenaAllocation, ArenaError>
pub fn allocate(&mut self, byte_len: u64) -> Result<ArenaAllocation, ArenaError>
Reserves the first address-ordered run large enough for byte_len.
§Errors
Empty, overflowing and unsatisfied requests are returned as values.
Sourcepub fn release(&mut self, allocation: ArenaAllocation) -> Result<(), ArenaError>
pub fn release(&mut self, allocation: ArenaAllocation) -> Result<(), ArenaError>
Releases a live allocation and coalesces adjacent free runs.
§Errors
Returns ArenaError::StaleAllocation when generation or extent no
longer matches the arena.
Sourcepub fn grow(&mut self, additional_pages: u32) -> Result<(), ArenaError>
pub fn grow(&mut self, additional_pages: u32) -> Result<(), ArenaError>
Appends free pages without moving any live allocation.
Existing byte offsets remain stable, allowing a physical owner to copy the old address space verbatim into a larger GPU buffer.
§Errors
Zero growth and page-count overflow are rejected as typed values.
Sourcepub const fn metrics(&self) -> ArenaMetrics
pub const fn metrics(&self) -> ArenaMetrics
Current cumulative counters.
Sourcepub fn capacity_bytes(&self) -> u64
pub fn capacity_bytes(&self) -> u64
Total bytes represented by the arena.
Sourcepub fn page_count(&self) -> u32
pub fn page_count(&self) -> u32
Number of addressable pages.