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.
2009-09-17 20:40:58
Yes, I am aware of /proc and others on Linux, but I need to do it programatically on HPUX.
2009-09-17 21:04:18
Sorry, I could not help more. Good luck.
2009-09-17 23:49:07
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
2009-09-18 01:35:40