index_alloc 0.1.1

A toy static allocator wich can serve as a global_allocator.
Documentation
  • Coverage
  • 54.72%
    29 out of 53 items documented5 out of 35 items with examples
  • Size
  • Source code size: 46.68 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Adi-df/index_alloc
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Adi-df

Index Alloc

A simple, toy static Allocator which use a fixed length array to store allocated data.

This crate expose a struct [IndexAllocator] which implement [GlobalAlloc] so it can be uses as the global allocator in no_std environment.

Disadvantages :

  • Extremely unsafe
  • Very slow
  • Memory inefficient

Even though it seems unusable, it has plenty of advantages :

  • Just kidding, don't use that

To store allocated memory, [IndexAllocator] uses a MemoryIndex which stores a list of regions containing the state of the region (size, from which address, used status). For instance :

use index_alloc::IndexAllocator;

#[global_allocator]
static ALLOCATOR: IndexAllocator<2048, 16> = IndexAllocator::empty();

fn main() {
    let test_str = String::from("Hello World");
    println!("{test_str}");
}

See more example in the Repository's Examples.