Possible Duplicate:
Measuring RAM usage of a program

I have a process, which is quite short-running (about 10 minutes), but memory heavy.

I want to know how much memory does the process uses at its peak. I want some way to track it, more efficient than running htop and writing down the memory usage every 20 seconds.

Ideally, I would like something like time - some way to write

trackmemory command

and the command would run and at the end, the memory usage would be shown. However, I will survive manually writing the pid somewhere; I just don't want to watch htop and writing it down.

marked as duplicate by Gilles, Renan, jasonwryan, phunehehe, Ulrich Dangel Sep 2 '12 at 0:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


I found out this answer Measuring RAM usage of a program

but that actually didn't work so well, because it shows me unrealistic numbers (memory 10 times higher than RAM+Swap together). What I did was

top -bp pid > memories

and then I filter the memories file using grep, sed and sort. It works quite well.

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