1829270 Members
13365 Online
109988 Solutions
New Discussion

Detect memory leak

 
Amit Kureel
Advisor

Detect memory leak

Can anybody tell me how to find if one of my running process has a memory leak, i.e., it is allocating memory continuously, but not freeing it ? What is the HP unix utility/command to monitor such a process ?
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: Detect memory leak

Hi Amit:

One way to spot a memory leak is to watch for growing usage by processes. The following uses the POSIX (UNIX95) options of the 'ps' command to assist in this tracking, ranking the output in descending kilobyte core size. Note that a space character follows the 'UNIX95' variable declaration and that the 'ps' command begins without any interceding delimiter. Thus, the variable UNIX95 is set only for the one command line.

# UNIX95= ps -e -o "user,vsz,pid,ppid,args" | sort -rnk2 | more

...JRF...
LB4
Valued Contributor

Re: Detect memory leak

There is a great utility called sarcheck.
www.sarcheck.com
boley janowski
Trusted Contributor

Re: Detect memory leak

James, i was just looking through my notes for that command, I figured this would be the answere for this ticket. Any way, glad you pointed it out. This is a very cool tool.
Mladen Despic
Honored Contributor

Re: Detect memory leak

Amit,

If you have Glance, check if you have this file

file=/opt/perf/examples/adviser/proc_mem_leak

If you do, try running

glance -adviser_only -syntax $file -j60 | tee glance.out

This will display information about potential memory hog processes every 60 seconds. Read $file for further info.

HTH