pileofrogs has asked for the wisdom of the Perl Monks concerning the following question:
Essentially, I'm using BSD::Resource to limit my script, and I'd like to know how much of these resources I'm actually using. The list of resources you can monitor with BSD::Resource::getrusage is smiler but actually very different from the list of resources you can limit. Specifically, you can limit virtual memory, but you can't look at your virtual memory usage. You can look at resident set size, but that doesn't seem to help me. (it always seems to say 0, even when I bust the vmem limit).
Devel::Size seems to work by walking through the code and totaling up the memory used. The system obviously has some simple value of my vmem size (otherwise, how does it know how to limit it?), so Devel::Size sounds inefficient for my purposes.
Anyone know a good way to get current vmem used?
Updated: This needs to work on Linux and OpenBSD.