#memory #memory-allocator #bitmap #allocator

no-std bitmap-allocator

Bit allocator based on segment tree algorithm

2 unstable releases

new 0.2.0 Dec 10, 2024
0.1.0 Jul 18, 2024

#118 in Memory management

Download history 155/week @ 2024-08-20 179/week @ 2024-08-27 354/week @ 2024-09-03 429/week @ 2024-09-10 390/week @ 2024-09-17 263/week @ 2024-09-24 94/week @ 2024-10-01 712/week @ 2024-10-08 1223/week @ 2024-10-15 690/week @ 2024-10-22 196/week @ 2024-10-29 121/week @ 2024-11-05 295/week @ 2024-11-12 514/week @ 2024-11-19 317/week @ 2024-11-26 393/week @ 2024-12-03

1,569 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