Hello,
I do not know wether or not this list is the best place to post this question. Please, feel free to redirect me, if necessary.
I know that the address space reserved for a process does not reflect the actual memory consumption. Some of the address space isn't mapped to anything, some is shared and won't be freed when the process exits. Some is wired and does not occupy space in RAM, some has been swapped out.
Given a PID, how can I get the memory currently used by a process ? Specifically I am looking for: • The private physical memory (RAM) used by the process for its code, stack, heap, data and allocated RAM • The swap space used by the process
But I am not interested in mapped files and shared memory. In short, I would like to determine how much memory (RAM and swap) would be freed by terminating the PID.
What functions should I call to get this info ? Thank you very much for your help
PS: I have found the source of TOP (which doesn't do exactly what I am looking for) but I can't download it. I see the Xcode project, all the files on HTML pages. Do I need to download them one by one ? Is there a faster way ? |