1847762 Members
3220 Online
104013 Solutions
New Discussion

Re: memory leak

 
xiaoqing
Occasional Contributor

memory leak

My server application run on HP-UX B.11.00 U 9000/800, and I overload operator new and delete to detect all memory allocate and free, and find all dynamic allocated memory is deleted. But as the server running, the memory usage of the process keep increasing fastly.

Is there any memory allocated cannot be found out by overloading new and delete even though in our application, all memory allocation use new and delete(no malloc() and free())?

Or is it possible that our system is not configure properly and cause memory is not released in time?

appreciate if you have any idea or suggestion.


12 REPLIES 12
Massimo Bianchi
Honored Contributor

Re: memory leak

Hi,
just the first check can be the last patches, there are a few that address memory leaks.

Second can be the compiler, which one are you using ?


Third can be any application, are you using any or are you just testing these functions ?

Fourth: have you any tool like mwa or glance ? with these you can check memory allocation and find who is guilty for the allocation.


There are also other posts regarding memory leak and how to find them, try with a serach and see if any can fit your needs.

HTH,
Massimo
RAC_1
Honored Contributor

Re: memory leak

Found this in search.

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 memory leak.

Apart from this there is glance adviser script in /opt/perf/examples/adviser.




There is no substitute to HARDWORK
Stefan Farrelly
Honored Contributor

Re: memory leak

Weve had this problem too.

Its caused by the vxfs dynamic inode cache - it keeps growing unless you set it to a limit. To do this set the following kernel parameters;

ninode
vx_ninode <90% of ninode>

Build kernel and reboot and immediately you will have more free memory and it wont leak!
We did this on an RP7400 with 8GB of RAM and it saved us between 1-2GB!
Im from Palmerston North, New Zealand, but somehow ended up in London...
Stefan Farrelly
Honored Contributor

Re: memory leak

oops, my last reply was for 11.11 - not 11.0
Please ignore, sorry.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Massimo Bianchi
Honored Contributor

Re: memory leak

Hi,
a thread that suggest how to check memory leak:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xdf630ea029a2d711abdc0090277a778c,00.html

For Stephan: thank for the info, i will keep it the same. Who knows....it is always a pleasure to learn something new !

HTH,
Massimo

Massimo Bianchi
Honored Contributor

Re: memory leak

Sorry Stefan, i think i must re-learn how to read names :)
Massimo

Fragon
Trusted Contributor

Re: memory leak

Hi xiaoqing,
Normally,memory leak is caused by the 3rd applications if you make lastest O/S patches installed. Most OS can't free the "leak memory" themselves.
An easy way to resolve this problem is to restart your system. For the case not permitted to be restarted, there are some tools to free "leak memory",but most is not free!

Learning more about this topic!

-ux
SSP_1
Regular Advisor

Re: memory leak

Hi Xio,

Better U apply the patch PHSS_28618. The patch can be applied on the fly and doesn't require a reboot.

The same was the case with me, I was just fed up for last 10 days with one of the hpux11.11 machine suffering from a memory leak problem. Today morning we have applied the patch PHSS_28618 on to it and suddenly teh problem got restored.

Suggest U to get the patch downloaded from itrc site and apply it asap.
Obstacles exist to challenge you to keep going. Not to quit.
A. Clay Stephenson
Acclaimed Contributor

Re: memory leak

First of all, note that any memory returned by delete (or free()) is not returned to the OS but it made available to the process's heap for subsequent reuse.

One of the most overlooked areas of memory leaks is the use of library functions (e.g. tempnam()) that dynamically allocate memory.
Pay careful attention to those. I would also look for and install the latest libC and compiler patches.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: memory leak

First of all, note that any memory returned by delete (or free()) is not returned to the OS but it made available to the process's heap for subsequent reuse.

One of the most overlooked areas of memory leaks is the use of library functions (e.g. tempnam()) that dynamically allocate memory.
Pay careful attention to those. I would also look for and install the latest libC and compiler patches.
If it ain't broke, I can fix that.
Caesar_3
Esteemed Contributor

Re: memory leak

Hello!

Rational have tools purify & quantify that
you compile your binary with those libs and
run the binary, in the end of run you have
monitor with all leaks that was when it run
and the source that you could see where the
problems.

Caesar
Steven E. Protter
Exalted Contributor

Re: memory leak

Before you start patching for memory leak, run Anil's test to see IF you have a memory leak.

You might just have a bad application that takes memory and doesn't release it properly. You might need to patch or upgrade the application.

That being said, the latest Quality Pack for 11.00 (March 2003) is almost never a bad idea. If you have a good connection and a software contract, you can download it and install it quickly.

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