# rustfs-mimalloc-sys
[](https://crates.io/crates/rustfs-mimalloc-sys)
[](https://docs.rs/rustfs-mimalloc-sys)
[](../LICENSE)
Low-level FFI bindings to [mimalloc](https://github.com/microsoft/mimalloc) V3 (v3.5.2).
For a safe, ergonomic wrapper, use [`rustfs-mimalloc`](https://crates.io/crates/rustfs-mimalloc).
## Usage
```toml
[dependencies]
rustfs-mimalloc-sys = "0.5.4"
```
```rust
unsafe {
let ptr = rustfs_mimalloc_sys::mi_malloc_aligned(64, 8);
// ... use ptr ...
rustfs_mimalloc_sys::mi_free(ptr);
}
```
## Features
| `secure` | Heap allocation encryption (MI_SECURE=4) |
| `debug` | mimalloc debug checks |
| `debug_in_debug` | Auto-enable `debug` in Cargo debug builds |
| `override` | Override system `malloc`/`free` |
| `local_dynamic_tls` | Use local-dynamic TLS model |
| `no_thp` | Disable Transparent Huge Pages |
## What's Included
This crate vendors the mimalloc V3 C source and compiles it via the `cc` crate. No system mimalloc installation required.
- Static linking — no runtime dependencies
- Platform-specific flags handled automatically (Windows libs, musl compat, TLS model)
- `links = "mimalloc"` — exports `DEP_MIMALLOC_INCLUDE` for downstream C/C++ crates
- V3.5.2 small allocation/free APIs, including `mi_wmalloc_small`,
`mi_wzalloc_small`, the thread-local heap word-size variants,
`mi_free_small_nonnull`, and inline Rust mirrors for `mi_malloc_csize`,
`mi_zalloc_csize`, `mi_theap_malloc_csize`, `mi_theap_zalloc_csize`,
`mi_free_csize`, and `mi_free_csize_nonnull`
- Raw experimental profiling FFI from `mimalloc-profile.h`
## MSRV
Rust 1.96.0. Rolling support window for the latest three stable Rust releases.
## License
Apache-2.0. The vendored mimalloc C library is MIT-licensed.