https://github.com/napi-rs/mimalloc-safe
A Fork from https://github.com/purpleprotocol/mimalloc_rust and keep updated with mimalloc
https://github.com/napi-rs/mimalloc-safe
Last synced: 12 months ago
JSON representation
A Fork from https://github.com/purpleprotocol/mimalloc_rust and keep updated with mimalloc
- Host: GitHub
- URL: https://github.com/napi-rs/mimalloc-safe
- Owner: napi-rs
- License: mit
- Created: 2025-03-05T14:04:56.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-16T11:16:56.000Z (about 1 year ago)
- Last Synced: 2025-06-18T20:12:02.952Z (about 1 year ago)
- Language: Rust
- Size: 230 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.txt
Awesome Lists containing this project
README
# `mimalloc-safe`
Forked from https://github.com/purpleprotocol/mimalloc_rust
[![Latest Version]][crates.io] [![Documentation]][docs.rs]
A drop-in global allocator wrapper around the [mimalloc](https://github.com/microsoft/mimalloc) allocator.
Mimalloc is a general purpose, performance oriented allocator built by Microsoft.
## Usage
```rust
use mimalloc_safe::MiMalloc;
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
```
## Requirements
A **C** compiler is required for building [mimalloc](https://github.com/microsoft/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](https://github.com/microsoft/mimalloc)
own benchmarks.
To enable secure mode, put in `Cargo.toml`:
```ini
[dependencies]
mimalloc-safe = { version = "*", features = ["secure"] }
```
[crates.io]: https://crates.io/crates/mimalloc-safe
[Latest Version]: https://img.shields.io/crates/v/mimalloc-safe.svg
[Documentation]: https://docs.rs/mimalloc-safe/badge.svg
[docs.rs]: https://docs.rs/mimalloc-safe