snmalloc-rs
provides a wrapper for microsoft/snmalloc
to make it usable as a global allocator for rust.
snmalloc is a research allocator. Its key design features are:
Some old benchmark results are available in the snmalloc
paper.
There are three features defined in this crate:
- debug
: Enable the Debug
mode in snmalloc
.
- 1mib
: Use the 1mib
chunk configuration.
- cache-friendly
: Make the allocator more cache friendly (setting CACHE_FRIENDLY_OFFSET
to 64
in building the library).
To use snmalloc-rs
add it as a dependency:
```toml
[dependencies] snmalloc-rs = "0.2" ```
To set SnMalloc
as the global allocator add this to your project:
```rust
static ALLOC: snmallocrs::SnMalloc = snmallocrs::SnMalloc; ```
mingw
version is only tested on nighly branch. Due to the complexity of locating GNU libraries on Windows environment,
the library requests you to provide a MINGW64_BIN
environment variable during compiling. Since GCC
does not provide a option for us
to link libatomic
statically, I have to use dynamic linking. Hence, please make sure the following libs are in your PATH
:
- winpthread
- atomic
- stdc++
- gcc_s
This is the best thing I can do for current stage, if you have any better solution, please do help me to provide a better support for
MinGW
upstream improve slow path performance for allocation
More CI (ARM64 on QEMU)
mingw
for older versions, see CHANGELOG