CC
CC copied to clipboard
Memory usage for each instance
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.