Operating System - Linux
1830005 Members
2914 Online
109998 Solutions
New Discussion

memory leak in HP-UX 11.23 11i v2

 
SOLVED
Go to solution
jackie_siu
Advisor

memory leak in HP-UX 11.23 11i v2

Hi all,
I recently move some system from Solaris to current HP-UX 11.23 v2 ,but I found a seriously memory leak in the this enviroment.because this is a real-billing system that has smoothly runned on different UNIX system,including Solaris,AIX,HP-UX 11i v1. And we never found this kind of serious problem before.
The things i want to know is if there is any aC++ compiler option or environment variables can influence the memory new/delete and malloc/free function?
Thanks!
10 REPLIES 10
A. Clay Stephenson
Acclaimed Contributor

Re: memory leak in HP-UX 11.23 11i v2

I would say the very first thing to look for assumming that your code is ok (and that is a big assumption because I've seen "perfect" code misbehave when a new platform exposed a weakness) would be to look for any libc patches. PHCO_35744 does fix some malloc memory leaks.
If it ain't broke, I can fix that.
Dennis Handly
Acclaimed Contributor

Re: memory leak in HP-UX 11.23 11i v2

>any aC++ compiler option or environment variables can influence the memory new/delete and malloc/free function?

malloc supports some options, but none for leak checking. See malloc(3).

If you are on IPF, you can use +check=heap. Or you can use gdb directly (on PA too) with the "set heap-check" and "info leak" options.
jackie_siu
Advisor

Re: memory leak in HP-UX 11.23 11i v2

Thanks a lot for your response!
I have installed the patch PHCO_35744 and all the Dependencies,but still haven't solved the problem.
the following is some other information I can provide:
all the sources are written in C++ syntaxï¼
we use multi-thread in the main flow;
we use many dynamic-link libraries in our system;
we have used some memory leak detection to check the problem,and finally found that the main memory leak is caused by failing to execute class destructor. it's to say that we use much delete/free operation in the class destructor,and the destructor can't effect when the class variable is destroied.
Dennis Handly
Acclaimed Contributor

Re: memory leak in HP-UX 11.23 11i v2

>we have used some memory leak detection to check the problem,and finally found that the main memory leak is caused by failing to execute class destructor.

That's pretty generic. A leak detection tool should show you where it is allocates and of what type. Of course the hard part is figuring where to delete an object.

>it's to say that we use much delete/free operation in the class destructor,and the destructor can't effect when the class variable is destroyed.

I'm not sure I understand this? Does your class have a bunch of pointers that also point into the heap? If so, you need to delete all of those pointers in your destructor.
Steven E. Protter
Exalted Contributor

Re: memory leak in HP-UX 11.23 11i v2

Shalom,

There are several memory leak issues with the OS that are resolved in the September 2006 bi-annaul QPK service pack. I recommend you test with that environment.

The aC++ Compiler should be updated to as close to current as possible.

But the normal cause of memory leaks is applicaiton code.

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
jackie_siu
Advisor

Re: memory leak in HP-UX 11.23 11i v2

thanks Steven,
but where can I find the bi-annual QPK? Can you give me the link?

thanks Dennis,
the problem is the destructor can't be executed when the variable's life-cycle is expire. Even I put some cout statement in the destructor,it can't print anything. I'm not sure if you have understand what I want to express.
James R. Ferguson
Acclaimed Contributor
Solution

Re: memory leak in HP-UX 11.23 11i v2

Hi:

The standard HP-UX patch bundles are issued twice yearly and are cumulative. For 11.23, use the March 2007 bundles:

http://www2.itrc.hp.com/service/patch/releasePage.do?BC=main|releaseIndexPage|&releaseId=0703-11.23

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: memory leak in HP-UX 11.23 11i v2

>the problem is the destructor can't be executed when the variable's life-cycle is expire.

Why not, you don't know when that is? That's usually why leaks occur because you don't know.

>Even I put some cout statement in the destructor, it can't print anything. I'm not sure if you have understand what I want to express.

Can't print anything useful??

Attach an example program that demonstrates it?

Have you used gdb's "set heap-check"?
jackie_siu
Advisor

Re: memory leak in HP-UX 11.23 11i v2

It's great!
I don't know how to express my thankfulness for you all! The problem has puzzled me for more than one monthes.
The application and source code has no problem. The only problem is missing of recently patch. after I have installed the patch PHCO_34944 and it's dependencies,the memory leak disappeared.
Thanks again for you all!!
jackie_siu
Advisor

Re: memory leak in HP-UX 11.23 11i v2

There are several memory leak issues with the OS that are resolved in the September 2006 bi-annaul QPK service pack. I recommend you test with that environment.