xalloc
Dynamic suballocators for external memory (e.g., Vulkan device memory).
Provided Algorithms
Generic
Name | Time Complexity | Space Complexity |
---|---|---|
TLSF (Two-Level Segregated Fit) | O(1) |
O(N + log size) |
Free space bitmap | O(size) |
O(size) |
Specialized
Name | Time Complexity | Space Complexity |
---|---|---|
Ring buffer | O(1) |
O(N) |
(size
: heap size measured by the number of allocation units, N
: number of allocations)
Examples
use ;
let mut tlsf = new;
// Allocate regions
let alloc1: = tlsf.alloc.unwrap;
let alloc2: = tlsf.alloc.unwrap;
let = alloc1;
let = alloc2;
println!;
println!;
// Deallocate a region
tlsf.dealloc.unwrap;
// Now we can allocate again
tlsf.alloc.unwrap;
tlsf.alloc.unwrap;
Feature Flags
nightly
— Enables optimizations which currently require a Nightly Rust compiler. This flag is now unused due to the stabilization ofNonNull
in Rust 1.25.
License: MIT