1832220 Members
2517 Online
110041 Solutions
New Discussion

memory leak script

 
Ragni Singh
Super Advisor

memory leak script

Hello everyone,

does anyone here have a script that reports on memory leak that they would lilke to share with. Any help will be greatly appreciated.
7 REPLIES 7
Stefan Farrelly
Honored Contributor

Re: memory leak script


I doubt very much there is a script which will do this for you. You have to be a bit more precise in order to find a memory leak. The method I use is;

1. reboot your server but do not start any apps (eg. Oracle)
2. use vmstat to get free memory total.
3. start apps.
4. use vmstat to get free memory total.
5. shutdown apps.
6. same as 4. Now - the free memory total should go back to what is was in 2. before the apps were started. If it doesnt you have a memory leak.
7. repeat for users - check free mem using vmstat, let users on, get users off, does free memory return to previous level ? if not you have a leak.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Bill McNAMARA_1
Honored Contributor

Re: memory leak script

Best way is via a small c program that does lots of mallocs and no frees in a loop!

Glance/top to watch Stack size increase..

Later,
Bill
It works for me (tm)
S.K. Chan
Honored Contributor

Re: memory leak script

Another approach (if you have glance) is to make use of glance's adviser syntax file (proc_mem_leak) to get your numbers.
# cd /opt/perf/examples
# glance -adviser_only -syntax ./proc_mem_leak -j30
==> Samples every 30secs.

You can easily modify "proc_mem_leak" to capture a wide scope of data. For exmaple by default the VSS is set to 30MB. You can change that setting and you'll get more data out of the glance output.
Stefan Farrelly
Honored Contributor

Re: memory leak script

In the previous reply the glance memory leak file is in this dir, cd here first;

/opt/perf/examples/adviser
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: memory leak script

Ive been running that glance adviser on some of our production servers and Im afraid it isnt very good, it only shows processes with VSS > 30Mb !
Im from Palmerston North, New Zealand, but somehow ended up in London...
S.K. Chan
Honored Contributor

Re: memory leak script

Thanks for the correction Stefan. You can actually modify the file "proc_mem_leak" and change the default value of VSSthreshold from 30000 to a lower value. It does not have to be at 30MB.
Eileen Millen
Trusted Contributor

Re: memory leak script

Hi Sanman,

You can use this command to find out how much memory is being used after booting up.
UNIX95= ps -e -o vsz=Kbytes -o pid,args=Command-Line | sort -rnk1
It is all one line.
Then try it again later to find out what is using the most memory.

Eileen