polymorph-allocator

Crates.iopolymorph-allocator
lib.rspolymorph-allocator
version1.2.0
sourcesrc
created_at2019-10-28 07:31:56.735047
updated_at2020-11-16 05:50:39.944141
descriptionA simple memory allocator
homepagehttps://sr.ht/~ren/polymorphos
repositoryhttps://git.sr.ht/~ren/polymorph-allocator
max_upload_size
id176314
size32,722
the iris system (u1f408)

documentation

README

polymorph-allocator

A simple Rust memory allocator, designed for polymorphOS.

This crate takes heavy inspiration from awooOS/dmm, a simple C memory allocator for bare-metal uses.

In it's current state, polymorph-allocator is usable, however it is likely to be slow for lots of small allocations. This is an artifact of it's design - every allocation requires iterating through the entire list of allocated chunks until a free chunk is found.

The next major release of polymorph-allocator is planned to completely change how the allocation works, which will improve it's speed, but also it's complexity. The current version of polymorph-allocator is rather simple to understand, and so it could be good as a learning tool. Who knows.

Usage

use polymorph_allocator::LockedAllocator;

#[global_allocator]
pub static ALLOCATOR: LockedAllocator = LockedAllocator::empty();

fn main() {
    // For a 32MB heap starting at 1MB in RAM:
    ALLOCATOR.lock().add_region(0x100000, 0x2000000);
}

License

polymorph-allocator is licensed under the MIT License, the same license as the rest of polymorphOS.

You can find this license in the LICENSE file in the top level of this repository.

Commit count: 0

cargo fmt