上QQ阅读APP看书,第一时间看更新
Custom allocators
It is possible to plug in one's own allocator to Rust, as can be done in C++ or similar system-level programming languages. By default, on most targets, Rust uses jemalloc with a backup alternative to the system-provided allocator. In embedded applications, there may not be a system, let alone an allocator, and the interested reader is recommended to peruse RFC 1183 (https://github.com/rust-lang/rfcs/blob/master/text/1183-swap-out-jemalloc.md), RFC 1398 (https://github.com/rust-lang/rfcs/pull/1398), and related RFCs. As of writing this, an interface for plugging in custom allocators to stable Rust is under active discussion and any such capability is only available in nightly Rust. We will not make use of custom allocators in this book.