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. Some recent benchmark results are listed at
bench_suite.
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).native-cpu
: Optimize snmalloc
for the native CPU of the host machine. (this is not a default behavior since 0.2.14
)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 nightly branch with MSYS environment. We are using dynamic linking method.
Hence, please make sure the following libs are in your PATH
:
winpthread
atomic
stdc++
gcc_s
Notice: since version 0.2.12
, we no longer require you to provide additional environment variables for mingw
target.
ANDROID_NDK
must be provided as an environment variableANDROID_PLATFORM
can be passed as an optional environment variableANDROID_ABI
used by CMake is detected automaticallyandroid-lld
can be used to set the linker of snmalloc
to lld
android-shared-std
can be used to set the STL library of snmalloc
to c++_shared
(it uses c++_static
by default)for older versions, see CHANGELOG