Skip to content

waynexia/unkai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unkai

Allocator proxy with statistics in "stack", "size" and "duration" axis.

Supported Feature

  • GlobalAlloc
    • Capture and record backtrace with memory consumption

Todos

  • GlobalAlloc
    • Record pointer's lifetime
  • Allocator
    • Tree-structured
    • Low-overhead in-use statistics
  • General
    • Prometheus integration
    • Build-in report generation

Example

cargo run --example collections --release
#[global_allocator]
static UNKAI: UnkaiGlobalAlloc<Jemalloc> = UnkaiGlobalAlloc::new(Jemalloc {}, 99, 5, 10);

fn main() {
    let mut container = Vec::with_capacity(10000);
    for _ in 0..10000 {
        let item = Vec::<usize>::with_capacity(1000);
        container.push(item);
    }

    for (bt, count) in UNKAI.report_symbol() {
        println!("{} bytes are allocated from:", count);
        println!("{}", bt);
    }
}

About

unkai(雲海) rises and falls, things come and gone, memory allocates and deallocates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages