Crates.io | tcmalloc-better |
lib.rs | tcmalloc-better |
version | 0.1.19 |
created_at | 2025-05-25 00:30:19.503043+00 |
updated_at | 2025-06-16 18:01:45.514056+00 |
description | A Rust wrapper over Google's TCMalloc memory allocator |
homepage | |
repository | https://github.com/maratik123/tcmalloc-better |
max_upload_size | |
id | 1687879 |
size | 31,336 |
A Rust wrapper over Google's TCMalloc memory allocator
A drop-in global allocator wrapper around the TCMalloc allocator. TCMalloc is a general-purpose, performance-oriented allocator built by Google.
Current TCMalloc wrappers rely on gperftools, which has been in a detached state from the main development branch for over 10 years and lacks modern features such as per-CPU caching.
This library is intended for use on Linux (x86_64, aarch64). For applications requiring support on a broader range of platforms, consider using malloc-best-effort, which automatically selects the best allocator based on the target platform.
use tcmalloc_better::TCMalloc;
#[global_allocator]
static GLOBAL: TCMalloc = TCMalloc;
fn main() {
TCMalloc::process_background_actions_thread();
// Rest of main
}
A C++ compiler is required for building TCMalloc with cargo.