# 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. [polymorphOS]: https://sr.ht/~ren/polymorphos [awooOS/dmm]: https://github.com/awooos/dmm ## Usage ```rust 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.