views:

231

answers:

2

What fields of getrusage do I use in order to check for memory leak on HPUX (what is the parallel to RES in 'top')?

A: 

I am not familiar with HPUX, but I would suggest compiling your programs on Linux. You can use valgrind, mtrace or possibly other tools to find memory leaks. Once a memory leak occurs, it always occurs, no matter what OS you are using. Just use an OS with a more complete tool set.

On Linux, you can read files in /proc to get memory usage.
Yes, I am aware of /proc and others on Linux, but I need to do it programatically on HPUX.
Sorry, I could not help more. Good luck.
A: 

Why not just run top in batch mode? If you have a leak you should see VIRT and RES going up over time.

top -b | grep yourProgram

This isn't going to help you find the leak(s) if you have them but its easier than messing with getrusage, which won't be any more help anyway.

Duck