Crate for checking how much heap memory code uses

Have you ever wanted to write a test like one of the following?

  • "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".

If so, you might be interested in the new version 0.3.0 of the dhat crate that I just released. It provides support for this, which I call "heap usage testing". I'm not aware of any other tool that lets you write these kinds of tests, in Rust or any other language.

The crate also provides some more typical heap profiling capabilities, too.

I hope the crate will be of interest!

9 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.