CC icon indicating copy to clipboard operation
CC copied to clipboard

Memory usage for each instance

Open rmolinari opened this issue 1 year ago • 4 comments

Thanks so much for this fascinating code!

I am suggesting a function that looks like this:

size_t memory_usage( <any container type> *cntr );

It would return the amount of (heap) memory associated with cntr.

Use case: when I am writing extension code for Ruby in C, the Ruby runtime likes to know how much memory is associated with a given object (although it doesn't insist on this knowledge). This helps with profiling and (I suspect) the Ruby garbage collector.

rmolinari avatar Jan 31 '23 16:01 rmolinari