1824964 Members
3524 Online
109678 Solutions
New Discussion юеВ

Re: memory leak

 
SOLVED
Go to solution
Tammy Liang
Regular Advisor

memory leak

swap usage increase progressively.
I think it is cuased by memory leak.
How to detect which process/application has
memory leak?

Tks..
take easy, enjoy life
7 REPLIES 7
Sridhar Bhaskarla
Honored Contributor
Solution

Re: memory leak

Hi Tammy,

Use the command

UNIX95= ps -e -o "vsz args" |sort -n

(Note the space between = and ps)

at regular intervals and note down the first column. It should not be increasing over the time. If so, that process may be having memory leak.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Massimo Bianchi
Honored Contributor

Re: memory leak

James R. Ferguson
Acclaimed Contributor

Re: memory leak

Hi Tammy:

One way to detect processes with memory leaks (which are application coding errors) is to monitor a process'es virtual size over time:

# UNIX95= ps -e -o "user,vsz,pid,ppid,args" | awk 'NR>1' | sort -rnk2

Note the blank (space) character after the equal sign and before the 'ps' command. This kimits the setting of UNIX95 to this command only.

Note, that the virtual size (vsz) is in kilobyte size pages (see the 'ps' man pages) and excludes buffer cache and other shared components such as shared libraries and shared memory regions.

A leaking process will grow over time.

Remember, hoever, that if a program calls free() to free memoary it has allocated, that that memory is only freed for the program's use until such time as it terminates. Thus seeing 100% overall memory utilization in utilities like 'glance' does not necessary signify any memory leak.

Regards!

...JRF...
SSP_1
Regular Advisor

Re: memory leak

Hi Tammy ,

U can use UNIX95 format command which is UNIX95= ps -eo "pid,ruser,pcpu,vsz=kbytes" -o args | sort -rn -k 4 | head

If there is a considerable ups and downs in the memory [vsz parameter] then there should be a sure memory leak. What I suggest you to apply the patch PHSS_28618 for the OS version you have. The patch is free download from itrc.hp.com site and doesn't requier a reboot.

shripad
Obstacles exist to challenge you to keep going. Not to quit.
RAC_1
Honored Contributor

Re: memory leak

In addition to above suggestions you can do following.

1. Reboot the server & note down free mem (vmstat command)
2. Start applications & note down free mem
3. Close applications and note down free mem.

Then you can compare the values for 1st and 3rd step. But this is bit lenghty process.

If you have glance check following.
/opt/perf/examples/adviser/proc_mem_leak.

Also as suggested use of UNIX95 variable will also give you some idea.
There is no substitute to HARDWORK
Tim Sanko
Trusted Contributor

Re: memory leak

Hello Tammy from Tim at B & W.

This is Tim Sanko, and I can give you several hints if you are the gal I know from B&W I am at extension 1856.

Tim


Patrick Preuss
Trusted Contributor

Re: memory leak

hi,

if you have GlancePlus

try

glance -adviser_only -syntax /opt/perf/examples/adviser/proc_mem_leak

HTH

regards

PMP
Goodbye Douglas! Whereever you are now, keep your towel and don't panic.