#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 397/week @ 2024-11-14 438/week @ 2024-11-21 248/week @ 2024-11-28 559/week @ 2024-12-05 475/week @ 2024-12-12 590/week @ 2024-12-19 651/week @ 2024-12-26 416/week @ 2025-01-02 390/week @ 2025-01-09 75/week @ 2025-01-16 119/week @ 2025-01-23 98/week @ 2025-01-30 465/week @ 2025-02-06 381/week @ 2025-02-13 218/week @ 2025-02-20 388/week @ 2025-02-27

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