Tracing memory usage for a function call?

I’m trying to better understand the memory requirements of some code I’m working on. I’ve used clj-memory-meter to size up the objects I’m using as inputs and return values, but what I’m missing is a way to see the total memory usage of a single function call (and all calls made from it). I’ve been looking at it through VisualVM and mat, but I haven’t found a way to collect this data.

Any ideas that would help me?

I recommend cli-async-profiler, where you can profile heap memory allocation in a flame graph like this one.

Indeed, that seems to be precisely what I need. I’ve used the clj-async-profiler wrapper in the past but only for CPU, I’d somehow missed it could do memory profiling as well.