Skip to main content

Crate range_alloc_arceos

Crate range_alloc_arceos 

Source
Expand description

A simple, fast range allocator for managing contiguous ranges of resources.

This crate provides a RangeAllocator that efficiently allocates and frees contiguous ranges from an initial range. It uses a best-fit allocation strategy to minimize memory fragmentation.

§Example

use range_alloc_arceos::RangeAllocator;

let mut allocator = RangeAllocator::new(0..100);

// Allocate a range of length 10
let range = allocator.allocate_range(10).unwrap();
assert_eq!(range, 0..10);

// Free the range when done
allocator.free_range(range);

Structs§

RangeAllocationError
Error type returned when a range allocation fails.
RangeAllocator
A range allocator that manages allocation and deallocation of contiguous ranges.