https://github.com/jmcomets/tcmalloc-rs
A drop-in GlobalAlloc implementation using tcmalloc from gperftools.
https://github.com/jmcomets/tcmalloc-rs
allocator profiling
Last synced: 7 months ago
JSON representation
A drop-in GlobalAlloc implementation using tcmalloc from gperftools.
- Host: GitHub
- URL: https://github.com/jmcomets/tcmalloc-rs
- Owner: jmcomets
- License: apache-2.0
- Created: 2018-05-28T14:53:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-11-02T05:58:46.000Z (over 2 years ago)
- Last Synced: 2025-06-29T09:07:19.127Z (7 months ago)
- Topics: allocator, profiling
- Language: Rust
- Homepage: https://crates.io/crates/tcmalloc
- Size: 23.4 KB
- Stars: 19
- Watchers: 0
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
tcmalloc
========
A drop-in [`GlobalAlloc`][1] implementation using `tcmalloc` from [gperftools][2].
[](https://travis-ci.org/jmcomets/tcmalloc-rs)
[](https://crates.io/crates/tcmalloc)
# Usage
Requires Rust 1.28+
```rust
extern crate tcmalloc;
use tcmalloc::TCMalloc;
#[global_allocator]
static GLOBAL: TCMalloc = TCMalloc;
```
Also note that you can only define one *global* allocator per application.
By default this crate expects to link to a system-installed tcmalloc. To build
the bundled copy of tcmalloc, enable the "bundled" feature. Note the [caveats
about profiling and libunwind/libgcc on 64-bit linux][4] — they are not
built by this crate, and tcmalloc will silently link to versions of both that
can cause profiling deadlocks.
[1]: https://doc.rust-lang.org/nightly/core/alloc/trait.GlobalAlloc.html
[2]: https://github.com/gperftools/gperftools
[3]: https://doc.rust-lang.org/nightly/unstable-book/language-features/global-allocator.html
[4]: https://github.com/gperftools/gperftools/blob/master/INSTALL#L33