monagement 0.0.2

TLSF Memory Management
Documentation
  • Coverage
  • 0%
    0 out of 16 items documented0 out of 0 items with examples
  • Size
  • Source code size: 78.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.99 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 31s Average build duration of successful builds.
  • all releases: 35s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • araxnoid-code

About

Monagement, is a memory allocator project written in rust that is based on the TLSF (Two-Level Segregated Fit) concept.

Main Architecture

Two-Level Segregated Fit

uses a 2-level bitmap hierarchy in searching for empty blocks, thus reducing the need for linear scanning.

Bitmap

use of bitmaps for fast search

Coalescing

any adjacent free blocks will be automatically merged to reduce fragmentation.

What's New?

see what's new in version 0.0.2: version/0.0.2

Changelog

changelog.md

Start

Installation

Run the following Cargo command in your project directory:

cargo add monagement

Or add the following line to your Cargo.toml:

monagement = "0.0.2"

Code

use monagement::{Monagement, MonagementInit};
use std::num::NonZeroU64;

fn main() {
    let allocator = Monagement::init(MonagementInit::default()).expect("Monagement Init Error");

    // allocate memory
    let allocate_a = allocator
        .allocate(NonZeroU64::new(12).unwrap())
        .expect("Memory Allocation A Error");
    let allocate_b = allocator
        .allocate(NonZeroU64::new(20).unwrap())
        .expect("Memory Allocation B Error");

    // free up memory
    allocate_a.free();
    // or
    drop(allocate_b);

    // get data link memory
    println!("{:#?}", allocator.borrow_core().get_linked_list());
}