Monitoring memory use
    Kent Johnson 
    kent37 at tds.net
       
    Fri Sep 21 09:44:44 EDT 2007
    
    
  
Alex Hewitt wrote:
> On Fri, 2007-09-21 at 08:27 -0400, Kent Johnson wrote:
>> Is there some way I can 
>> wrap the cron job to log the memory used by the process?
> 
> One simple way 'ps aux | grep myjob'
> 
> If you loop on this and redirect the output to a file you can watch your
> program grow. There is also a memstat utility that may or may not be
> available on the system you are using.
I was hoping for a utility that would wrap the process in some way and 
report the high-water memory use of the process. Oh well...
I guess I can write this myself as a Python program that runs the 
desired program as a child process and monitors its memory usage by 
reading /proc/<pid>/stats. There is also the Python library function 
resource.getrusage() but it doesn't seem to help - the ru_maxrss 
parameter is always 0.
Thanks,
Kent
    
    
More information about the gnhlug-discuss
mailing list