7 releases

0.2.3 Mar 4, 2025
0.2.3-alpha.1 Mar 3, 2025
0.1.44 Jan 17, 2025

#162 in Memory management

Download history 298/week @ 2025-01-14 232/week @ 2025-01-21 98/week @ 2025-01-28 295/week @ 2025-02-04 417/week @ 2025-02-11 232/week @ 2025-02-18 351/week @ 2025-02-25 314/week @ 2025-03-04 200/week @ 2025-03-11

1,180 downloads per month

MIT license

1MB
20K SLoC

C 19K SLoC // 0.2% comments Rust 501 SLoC // 0.0% comments

Mimalloc Rust

This is a FORKED version of Mimalloc Rust.

  • Support mimalloc v3, use feature v3 to enable.
  • Changed name from mimalloc to mimalloc-rspack and libmimalloc-sys
  • Versions of rust crates are changed to v0.2
  • package.links was removed in libmimalloc-sys-rspack. Now, you will be responsible for not linking multiple copies of the same mimalloc

Latest Version Documentation

A drop-in global allocator wrapper around the mimalloc allocator. Mimalloc is a general purpose, performance oriented allocator built by Microsoft.

Usage

use mimalloc::MiMalloc;

#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;

Requirements

A C compiler is required for building mimalloc with cargo.

Usage with secure mode

Using secure mode adds guard pages, randomized allocation, encrypted free lists, etc. The performance penalty is usually around 10% according to mimalloc own benchmarks.

To enable secure mode, put in Cargo.toml:

[dependencies]
mimalloc = { version = "*", features = ["secure"] }

Dependencies