Operating System - HP-UX
1822439 Members
2720 Online
109642 Solutions
New Discussion

Memory Leak High Level View

 
Anurag_7
Advisor

Memory Leak High Level View

Hi All,

I wanted to analyze the memory consumption of the server processes related to my application so as to see if they are leaking memory over a period of time of usage.

Someone suggested me the following.

export UNIX95=1
ps -A -o stime,pcpu,sz,vsz,args


Question 1: Which column out of SZ and VSZ, if increases over a period of time indicates memory leak?

Question 2: What is the difference between SZ and VSZ?

Question 3: If at any point of time, the value of one of these is A and if initially it was B then does it mean that the memory leaked is (A-B)???

Question 4: Which tool do you recommend for code level analysis of memory leak? Its a C++ application.

Please advise.

Any help in this regard would be highly appreciated.

Thanks

Anurag
1 REPLY 1
A. Clay Stephenson
Acclaimed Contributor

Re: Memory Leak High Level View

1)If either of these increase significantly over time, there MAY be a memory leak. However, these values may be increasing by design caching more and more data as time goes on until (hopefully) some equilibrium value is reached.

2) They are diffrent expressions of the same quantity; sz is in units of pages while vsz is in KiB.

3) No, only that there may be a memory leak; it all depends upon program design.

4) My favorite tool for finding memory leaks is my head. Every constructor must have a destructor. Every malloc() must have a free(). PurifyPlus is a rather good tool but really there are no excuses for memory leaks; it's just sloppy programming.



If it ain't broke, I can fix that.