RFC on new API for `dhat` heap profiling crate

69 points nnethercote

I am requesting comment on a new design for my dhat-rs profiling crate at https://github.com/nnethercote/dhat-rs/issues/17.

As well as a major API overhaul, there is a cool new feature called "heap usage testing".

Heap usage testing lets you write tests for conditions like:

  • "This code should do exactly 96 heap allocations"
  • "The peak heap usage of this code should be less than 10 MiB"
  • "This code should free all heap allocations before finishing"

It provides helpful details if these fail.

I think this is a solid re-design of the APIs, and the heap usage testing is a genuinely useful capability that isn't available in any other way.

I would like to hear feedback about the APIs and the implementation. Reports from people who have tried it out on real-world code are particularly appreciated. Thanks!

(The corresponding Twitter thread was here: https://twitter.com/nnethercote/status/1468791893123207171)