#memory #memory-allocator #bitmap #allocator

no-std bitmap-allocator

Bit allocator based on segment tree algorithm

2 unstable releases

0.2.0 Dec 10, 2024
0.1.0 Jul 18, 2024

#151 in Memory management

Download history 361/week @ 2024-10-27 85/week @ 2024-11-03 260/week @ 2024-11-10 533/week @ 2024-11-17 313/week @ 2024-11-24 410/week @ 2024-12-01 586/week @ 2024-12-08 456/week @ 2024-12-15 628/week @ 2024-12-22 585/week @ 2024-12-29 418/week @ 2025-01-05 188/week @ 2025-01-12 137/week @ 2025-01-19 60/week @ 2025-01-26 365/week @ 2025-02-02 264/week @ 2025-02-09

827 downloads per month

MIT license

18KB
397 lines

BitmapAllocator

Crates.io Docs.rs CI

Bit allocator based on segment tree algorithm.

Example

use bitmap_allocator::{BitAlloc, BitAlloc1M};

let mut ba = BitAlloc1M::default();
ba.insert(0..16);
for i in 0..16 {
    assert!(ba.test(i));
}
ba.remove(2..8);
assert_eq!(ba.alloc(), Some(0));
assert_eq!(ba.alloc(), Some(1));
assert_eq!(ba.alloc(), Some(8));
ba.dealloc(0);
ba.dealloc(1);
ba.dealloc(8);

Dependencies

~29KB