How do I monitor the peak memory consumed by a process in Linux? This is not a program I can internally modify to measure peak memory usage.
I do not really want detailed measurements, nor do I want them to slow down my program excessively.. so valgrind or anything heavyweight is not what I am looking for... And like other posts earlier [http://stackoverflow.com/questions/774556/peak-memory-usage-of-a-linux-unix-process], time -v doesn't seem to report memory for my machine...
I can just run top or ps and extract the memory consumed strings for my process id using a simple script. However, my process runs for about 20-30 minutes so I want to be able to log and get the max. I can tolerate coarse grained samples... every 1-minute or so... Specifically how do I-> 1. fork this simple mem-measure script in zsh? 2. kill it when the process-under-test finishes?