#jemalloc #allocator #control-api #api-bindings

no-std jemalloc-ctl

A safe wrapper over jemalloc's control and introspection APIs

10 releases

0.5.4 Jul 27, 2023
0.5.0 May 25, 2022
0.3.3 Jun 16, 2019
0.2.0 Aug 2, 2018
0.1.1 Oct 27, 2017

#205 in Memory management

Download history 57893/week @ 2024-10-25 47801/week @ 2024-11-01 58062/week @ 2024-11-08 80707/week @ 2024-11-15 40807/week @ 2024-11-22 51658/week @ 2024-11-29 70693/week @ 2024-12-06 70176/week @ 2024-12-13 15300/week @ 2024-12-20 10964/week @ 2024-12-27 50904/week @ 2025-01-03 64858/week @ 2025-01-10 48712/week @ 2025-01-17 46805/week @ 2025-01-24 57888/week @ 2025-01-31 67443/week @ 2025-02-07

237,879 downloads per month
Used in 25 crates (17 directly)

MIT/Apache

2MB
52K SLoC

C 47K SLoC // 0.1% comments Rust 1.5K SLoC // 0.1% comments Visual Studio Project 1.5K SLoC M4 658 SLoC // 0.1% comments Shell 380 SLoC // 0.3% comments C++ 371 SLoC // 0.1% comments Python 261 SLoC // 0.3% comments Visual Studio Solution 125 SLoC XSL 9 SLoC

jemalloc-ctl

Travis-CI Status Latest Version docs

A safe wrapper over jemalloc's mallctl*() control and introspection APIs.

Documentation

Platform support

Supported on all platforms supported by the jemallocator crate.

Example


use std::thread;
use std::time::Duration;
use jemalloc_ctl::{stats, epoch};

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

fn main() {
    // Obtain a MIB for the `epoch`, `stats.allocated`, and
    // `atats.resident` keys:
    let e = epoch::mib().unwrap();
    let allocated = stats::allocated::mib().unwrap();
    let resident = stats::resident::mib().unwrap();
    
    loop {
        // Many statistics are cached and only updated 
        // when the epoch is advanced:
        e.advance().unwrap();
        
        // Read statistics using MIB key:
        let allocated = allocated.read().unwrap();
        let resident = resident.read().unwrap();
        println!("{} bytes allocated/{} bytes resident", allocated, resident);
        thread::sleep(Duration::from_secs(10));
    }
}

License

This project is licensed under either of

at your option.

Contribution

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

Dependencies

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy