baby-mimalloc

Crates.iobaby-mimalloc
lib.rsbaby-mimalloc
version0.2.1
created_at2024-12-09 07:49:50.76186+00
updated_at2024-12-18 04:34:17.396075+00
descriptionMimalloc implemented in Rust (not a binding to the C library) with only basic features.
homepage
repositoryhttps://github.com/ouuan/baby-mimalloc
max_upload_size
id1477073
size67,529
Yufan You (ouuan)

documentation

README

baby-mimalloc

Crates.io Version docs.rs

Mimalloc implemented in Rust (not a binding to the C library) with only basic features.

Lock-free multi-threading, security features, and some performance enhancements are not implemented.

It can be used in no_std environments.

Crate Features

  • mmap - Provide MimallocMmap that uses mmap as OS allocator for segments.
  • std_mutex - Provide MimallocMutexWrapper that wraps Mimalloc inside std::sync::Mutex and implements GlobalAlloc.
  • spin_mutex - Provide MimallocMutexWrapper that wraps Mimalloc inside spin::Mutex that can be used in no_std environments.
  • deferred_free - Enable registering a hook to complete deferred free events. See the documentation of mi_register_deferred_free.

Usage

[dependencies]
baby-mimalloc = { version = "*", features = ["mmap", "std_mutex"] }
# baby-mimalloc = { version = "*", features = ["mmap", "spin_mutex"] }
use baby_mimalloc::{new_mimalloc_mmap_mutex, MimallocMmapMutex};

#[global_allocator]
static ALLOCATOR: MimallocMmapMutex = new_mimalloc_mmap_mutex();
Commit count: 18

cargo fmt