Memory Use Profiling
(The quick-and-dirty recipe below has only been tested on OS X)
Start a job at the command line and immediately suspend it with ctrl-Z.
Use the ps command to get the pid of your job.
Start top in a different window with the output going to a file:
top -pid <pid> -l 0 -stats cpu,time,rsize,vsize > top.log
Resume the suspended job with fg.
When the job finishes, stop the top logging with ctrl-C.
Extract columns of cpusec,cpu%,rsize,vsize from the captured top output using this python script:
./topstats.py top.log > top.dat
Plot memory usage in Gb vs elapsed CPU time with gnuplot:
plot 'top.dat' using 1:3 with lines