system.getTotalMem + friends have their use but as mentioned they're not monitoring everything, eg calls to malloc etc.
I'm surprised noone mentioned `getrusage`. I'd like an API `getResourceUsage` that wraps it in a platform-independent way, see <https://github.com/timotheecour/Nim/issues/446> Perhaps `getResourceUsage` could report also other things besides what's reported in `getrusage`.