#jemalloc #分配器 #API绑定

无需std jemalloc-ctl

jemalloc控制与内省API的安全封装

10个版本

0.5.4 2023年7月27日
0.5.0 2022年5月25日
0.3.3 2019年6月16日
0.2.0 2018年8月2日
0.1.1 2017年10月27日

#71 in 内存管理

Download history · Rust 包仓库 55842/week @ 2024-04-22 · Rust 包仓库 51780/week @ 2024-04-29 · Rust 包仓库 48392/week @ 2024-05-06 · Rust 包仓库 56381/week @ 2024-05-13 · Rust 包仓库 64054/week @ 2024-05-20 · Rust 包仓库 50397/week @ 2024-05-27 · Rust 包仓库 53849/week @ 2024-06-03 · Rust 包仓库 70332/week @ 2024-06-10 · Rust 包仓库 51375/week @ 2024-06-17 · Rust 包仓库 61453/week @ 2024-06-24 · Rust 包仓库 42216/week @ 2024-07-01 · Rust 包仓库 66412/week @ 2024-07-08 · Rust 包仓库 58339/week @ 2024-07-15 · Rust 包仓库 63144/week @ 2024-07-22 · Rust 包仓库 53951/week @ 2024-07-29 · Rust 包仓库 55571/week @ 2024-08-05 · Rust 包仓库

233,164每月下载量
23个Crates中(15个直接)使用

MIT/Apache

2MB
52K SLoC

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

jemalloc-ctl

Travis-CI Status Latest Version docs

jemalloc的mallctl*()控制与内省API的安全封装。

文档

平台支持

支持jemallocator Crates支持的所有平台。

示例


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));
    }
}

许可证

此项目根据您的选择,受以下任一许可证的许可:

贡献

除非您明确声明,否则您提交给jemalloc-ctl的任何有意贡献,根据Apache-2.0许可证的定义,应如上所述双重许可,无需任何额外条款或条件。

依赖项