Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer

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