jemallocator/jemalloc-ctl
2019-02-27 09:39:39 +01:00
..
src make the API of jemalloc_ctl sound 2019-02-27 09:39:39 +01:00
Cargo.toml jemalloc-ctl does not build for musl targets 2019-02-27 09:39:39 +01:00
LICENSE-APACHE add jemalloc-ctl 2019-02-27 09:39:39 +01:00
LICENSE-MIT add jemalloc-ctl 2019-02-27 09:39:39 +01:00
README.md add jemalloc-ctl 2019-02-27 09:39:39 +01:00

jemalloc-ctl

Travis-CI Status Appveyor 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

extern crate jemallocator;
extern crate jemalloc_ctl;

use std::thread;
use std::time::Duration;

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

fn main() {
    loop {
        // many statistics are cached and only updated when the epoch is advanced.
        jemalloc_ctl::epoch().unwrap();

        let allocated = jemalloc_ctl::stats::allocated().unwrap();
        let resident = jemalloc_ctl::stats::resident().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.