6 releases

0.2.2 May 17, 2021
0.2.0 May 15, 2020
0.1.3 Nov 5, 2019

#105 in Memory management

Download history 429/week @ 2024-03-02 543/week @ 2024-03-09 329/week @ 2024-03-16 306/week @ 2024-03-23 338/week @ 2024-03-30 266/week @ 2024-04-06 286/week @ 2024-04-13 311/week @ 2024-04-20 283/week @ 2024-04-27 263/week @ 2024-05-04 320/week @ 2024-05-11 268/week @ 2024-05-18 292/week @ 2024-05-25 317/week @ 2024-06-01 265/week @ 2024-06-08 377/week @ 2024-06-15

1,277 downloads per month
Used in 6 crates



C 4K SLoC // 0.1% comments Python 2.5K SLoC // 0.0% comments Visual Studio Project 664 SLoC Rust 221 SLoC // 0.2% comments C++ 167 SLoC Visual Studio Solution 50 SLoC

🐏 rpmalloc-rs

Embark Embark Crates.io Docs dependency status Build Status

Cross-platform Rust global memory allocator using rpmalloc.

See the rpmalloc README for a detailed description of how the allocator works, peforms, and compares with other allocators.

How to use

To use rpmalloc as the global allocator in your Rust binary crate, in Cargo.toml add:

rpmalloc = "0.2.0"

And then in one of your .rs files:

static ALLOC: rpmalloc::RpMalloc = rpmalloc::RpMalloc;


It is also possible to configure how the allocator should be built through a set of feature flags that correspond to the rpmalloc C library ENABLE_x defines:

  • Overall: statistics, validate_args, asserts, guards
  • Cache: unlimited_cache, unlimited_global_cache, unlimited_thread_cache, global_cache, thread_cache, adaptive_thread_cache

Example usage:

rpmalloc = { version = "0.2.0", features = ["guards", "statistics"] }

See rpmalloc README for detailed descriptions of the config options.

Note that all of these have not been tested together with this Rust crate.


This crate has been tested to support the following platforms and Rust targets:

  • x86_64-pc-windows-msvc
  • x86_64-apple-darwin
  • x86_64-unknown-linux-gnu

PRs to increase the amount of supported targets are welcome, but they should add CI verification and avoid adding additional dependencies.


Contributor Covenant

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started.


Licensed under either of

at your option.

Note that the rpmalloc library this crate uses is under public domain, and can also be licensed under MIT.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.