#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

#104 in Memory management

Download history 352/week @ 2024-09-20 153/week @ 2024-09-27 365/week @ 2024-10-04 1041/week @ 2024-10-11 980/week @ 2024-10-18 449/week @ 2024-10-25 96/week @ 2024-11-01 256/week @ 2024-11-08 427/week @ 2024-11-15 411/week @ 2024-11-22 339/week @ 2024-11-29 592/week @ 2024-12-06 364/week @ 2024-12-13 716/week @ 2024-12-20 641/week @ 2024-12-27 366/week @ 2025-01-03

2,243 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