blad-mem 0.0.1

Heap and RSS instrumentation for blad
Documentation
  • Coverage
  • 90.91%
    10 out of 11 items documented0 out of 7 items with examples
  • Size
  • Source code size: 7.32 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 425.32 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • n0tbhargav/blad
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • n0tbhargav

Memory instrumentation.

Two numbers, deliberately, because they answer different questions and their difference is itself informative:

  • Heap — bytes we allocated, counted exactly by wrapping the global allocator. Resettable, so it can be attributed per phase.
  • RSS — what the OS considers resident, a monotonic high-water mark from getrusage. Includes things the heap counter cannot see: dirty pages from temp files, mapped libraries, allocator overhead.

The gap between them is the cost of everything that is not our data structures. For blad that is dominated by the temp files the shell-out codec round-trips through — which is exactly the kind of thing that stays invisible if you only measure one.

Usage

The binary installs the allocator:

#[global_allocator]
static ALLOC: blad_mem::Tracking<std::alloc::System> =
    blad_mem::Tracking(std::alloc::System);

Without that, [heap_peak] reports zero and everything still works — instrumentation must never be load-bearing.