Operating System - HP-UX
1833803 Members
2337 Online
110063 Solutions
New Discussion

Re: How to check for memory leak

 
SOLVED
Go to solution
Charles Li_1
Advisor

How to check for memory leak

We are using Oracle 9iASr2. We are stopping and re-starting 9iAS everynight. We would like to know how to check wether 9iAS contributes to memory leak.
One way I can think of is to check the value of free memory after each start and see if it goes down.
Is there a better way?
How to check to value of free memory, I do not have root access.

Thanks
Charles
18 REPLIES 18
Ken Hubnik_2
Honored Contributor
Solution

Re: How to check for memory leak

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.
A. Clay Stephenson
Acclaimed Contributor

Re: How to check for memory leak

I would setup a cronjob to append to a logfile using the following command:

UNIX95= ps -u oracle -o vsz,comm

That will display the current size of all oracle owned processes along with the name of the command. If you see that some of them grow significantly over time, there is your leak.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: How to check for memory leak

Hi Charles:

Run this periodically and watch for growth in the process size:

...If you want to target a specific process by its command basename:

# UNIX95= ps -C thebasename -o "user,vsz,pid,ppid,args"

,,,or, if you want to look at all processes by descending process size:

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

In both cases, the blank (space) character after the equal sign and before the 'ps' command sets the UNIX95 option for the command line only.

Regards!

...JRF...
Charles Li_1
Advisor

Re: How to check for memory leak

Thanks.
Is there a way just to see how much memory is free, after each re-start of the oracle software. This server only runs this one oracle software, plus the systems software.
If the oracle software leaks memory, I will have to reboot the server.

Thanks
Charles
Steven E. Protter
Exalted Contributor

Re: How to check for memory leak

If you are running Oracle 9ias and you are not on one of the later patch levels, you can be assured that you do indeed have a memory leak.

Oracles notes say the latest greatest patches address this issue. Oracle hasn't seemed to be able to get ias out the door without this problem.

You should follow the checklist below to minimize this and other problems:

java is on the latest version from http://www.hp.com/go/java and all required patches for your version are in. I believe that java 1.4 is not certified for any Oracle products. Take care that SHLIB_PATH is correct.

Oracle's required OS patches for 9ias, and the database are installed. Check this site for supersedes, almost nothing listed on http://metalkink.oracle.com is current with regards to HP-UX.

As always, I am most impressed with the commands listed by the esteemed Olympians.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Charles Li_1
Advisor

Re: How to check for memory leak

Since this software is by Oracle, I am not able to really tune it, when it comes to memory leaks (or am I wrong?). The only thing I can come up with to deal with memory leak is to reboot the server. To look at free memory after each restart of the software is my way of looking for memory leak (any other suggestions?)

Thanks
Charles
James R. Ferguson
Acclaimed Contributor

Re: How to check for memory leak

Hi Charles:

Memory leaks are programming errors. The "fix" is to correct the code. No amount of tuning is going to help.

Regards!

...JRF...
Charles Li_1
Advisor

Re: How to check for memory leak

You are correct. But, I can not fix Oracle's codes. I can only reboot the server is I detect memory leak. We are waiting for version 904 to come out, but at the mean time, we still need to do something.

Thanks
Charles
doug mielke
Respected Contributor

Re: How to check for memory leak

while there is no way to tune around a memory leak, we've been sucessful in identifying the leak with the mentioned ps options, and periodicaly stopping and starting that process. Not all leaks will release the memory when the process dies, but we have a few comercial packages that do, and this work around corrects it for us.
A. Clay Stephenson
Acclaimed Contributor

Re: How to check for memory leak

In that case, once you have identified which process/executable is leaking, you can contact Oracle support or search the MetaLink yourself to see if there is a patch for your current release.
If it ain't broke, I can fix that.
Charles Li_1
Advisor

Re: How to check for memory leak

Thanks for all your suggestions.
I would still like to get a command to just show me the free memory available everytime before I restart the 9iAS software. (Similar to what I can with top)

Thanks
Charles
James R. Ferguson
Acclaimed Contributor

Re: How to check for memory leak

Hi (again) Charles:

With regard to your question of how to discover the free memory, do:

# echo freemem/D|adb /stand/vmunix /dev/kmem

The value returned is in 'pages'.

# getconf PAGE_SIZE

...returns the PAGE_SIZE (usually 4096 bytes). Thus if I have:

# echo freemem/D|adb /stand/vmunix /dev/kmem
freemem:
freemem: 39697

...with a PAGE_SIZE of 4096, I have:

39697*4095 = 162,598,912 bytes free

Regards!

...JRF...
Charles Li_1
Advisor

Re: How to check for memory leak

James,
I do not have root access. Is there a way to get the free memory without root access?

Thanks
Charles
twang
Honored Contributor

Re: How to check for memory leak

Use the following code to find out how many ram in total is claimed by "oracle":
#!/bin/ksh

m=0
for j in `UNIX95= ps -e -o vsz=Kbytes -o ruser -o pid,args=Command-Line | sort -
rnk1 | grep -v Kbytes | grep ora | awk '{print $1}'`
do
m=`expr $m + $j`
done
echo "\n Oracle user claimed RAM is $m Kbytes.\n"
Con O'Kelly
Honored Contributor

Re: How to check for memory leak

Hi Charles

If you don't have root access you can check free memory on the system using either glance ('m' option) if its installed or vmstat.
In vmstat look at the "free" column & multiply by 4 to give free memory in KB.

Example:
# vmstat 1 2| tail -1 | awk '{printf "%d\n", ($5*4)/1024}'

This will show free menory in MB.


Cheers
Con
Nitsulenko Sergey
Frequent Advisor

Re: How to check for memory leak

Hello!
Sorry for my English.
May be it is parameters of mod PLSQL. Try off/on kache parameters (http://...../pls/admin_/)....
It helped us.
sin
RAC_1
Honored Contributor

Re: How to check for memory leak

Using UNIX95 varibale I would watch the memory utilization of 9iAS process. If it is consistantly grwoing up you can have a closer look at it.

One good way of checking it is as follows-

1 reboot server, do not start anything, note down mem utilization.

2. Start 9iAS, note down mem utilization

3 shut it down and again note down mem utilization.

4. Now this value at step 4 should almost match to the value taken at step 1

This is lengthy process, but would give you if 9iAS is causing the problem

You can also check the file proc_mem_leak under /opt/perf/examples/adviser.
There is no substitute to HARDWORK
Charles Li_1
Advisor

Re: How to check for memory leak

.