Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

From the command line, how would I get the total physical and virtual memory usage of a process and all of its descendants (not just 1st-level children)?

This is useful when you want to monitor the memory usage of applications that are not monolithic. For instance, Google Chrome spawns a whole bunch of workers and renderers, even though to the user, it's all in only one GUI window. Another example is Firefox, which has separate processes for its plugins.

The Activity Monitor application can display the processes in a hierarchy. But I find it not good enough, for two reasons:

  • It's not command-line;
  • It doesn't sum the numbers for me.
share|improve this question

1 Answer 1

If using third-party applications is a possibility, I would suggest that you install the htop process monitor, perhaps from Macports. This tool extends top with a nice layout, and most relevant for your use case, it has an arbitrarily deep thread tree view that can be turned on with the F5 key.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.