Track memory usage of a job on SGE
This is an old question, but if you still have not figured it out you can type
qstat -j <Job_ID>
The category "maxvmem" gives you the maximum amount of RAM your job used when it was running. So the value of maxvmem is the number you are looking for to find the largest amount of memory your job used while it was running.
Also, you can only use qstat while your job is running. If you want to see the memory usage after your job finishes you have to use
qacct -j <Job_ID>.
Hope this helps and below is a link with more information.
http://wiki.genomics.upenn.edu/index.php/HPC:Large_memory_jobs