Operating System - HP-UX
1752290 Members
4697 Online
108786 Solutions
New Discussion юеВ

Re: what is memory leak & how to catch it on 11iv2

 
Rajesh Devada
Occasional Contributor

what is memory leak & how to catch it on 11iv2

I want to know the basics of memory leak & how to troubleshoot.

Thanks & Regards
Rajesh
6 REPLIES 6
Vihang.
Trusted Contributor

Re: what is memory leak & how to catch it on 11iv2

Hi Rajesh,

Something I got from whatis.com

A memory leak is the gradual loss of available computer memory when a program (an application or part of the operating system) repeatedly fails to return memory that it has obtained for temporary use. As a result, the available memory for that application or that part of the operating system becomes exhausted and the program can no longer function. For a program that is frequently opened or called or that runs continuously, even a very small memory leak can eventually cause the program or the system to terminate. A memory leak is the result of a program bug.
Some operating systems provide memory leak detection so that a problem can be detected before an application or the operating system crashes. Some program development tools also provide automatic "housekeeping" for the developer. It is always the best programming practice to return memory and any temporary file to the operating system after the program no longer needs it.

Regards,
Vihang.
Vihang.
Trusted Contributor

Re: what is memory leak & how to catch it on 11iv2

Hi Rajesh,

Guess the below thread might give you some useful insights.

http://forums11.itrc.hp.com/service/forums/questionanswer.do?admit=109447626+1219472850243+28353475&threadId=1127688


Regards,
Vihang.
Asif Sharif
Honored Contributor

Re: what is memory leak & how to catch it on 11iv2

Hi Rajesh,

Memory leak detector

http://www.hpux.ws/?p=8

Regards,
Asif Sharif
Regards,
Asif Sharif
Dennis Handly
Acclaimed Contributor

Re: what is memory leak & how to catch it on 11iv2

Basically leaks are heap areas that you no longer have a pointer to them.

You can use gdb to detect them:
http://www.hp.com/go/wdb

Here is a wdb whitepaper:
http://h21007.www2.hp.com/portal/download/files/unprot/devresource/Tools/wdb/doc/Memorydebugging.pdf
Deepak Kr
Respected Contributor

Re: what is memory leak & how to catch it on 11iv2

Memory leaks:

Memory bunches(heaps) are allocated to some application/OS processes but never deallocated if though that process is gone.

When a system does not correctly manage its memory allocations, it is said to leak memory. A memory leak is a bug. Symptoms can include reduced performance and failure.

Tools you can try:

mpr-2.2
=======
http:// hpux .connect.org.uk/hppd/ hpux /Development/Libraries/mpr-2.2/
Mpr finds malloc and realloc memory leaks and memory allocation statistics by using a simple, brute force strategy, it logs all malloc and free calls to a file and post processes this log file when the program terminates.

dmalloc-5.4.2
=============
http:// hpux .connect.org.uk/hppd/ hpux /Users/dmalloc-5.4.2/
The debug memory allocation or dmalloc library has been designed as a drop in replacement for the system's malloc, realloc, alloc, free and other memory management routines while providing powerful debugging facilities configurable at runtime. These facilities include such things as memory - leak tracking, fence-post write detection , file and line number reporting, and general logging of statistics.
"There is always some scope for improvement"
Bill Hassell
Honored Contributor

Re: what is memory leak & how to catch it on 11iv2

First, you have to determine whether you have a memory leak. If you are reasonably up to date on patches for 11v2, then the OS and commands are OK. Only the applications need examining. Use this command:

UNIX95=1 ps -e -o vsz,pid,ppid,args | sort -rn | head -20

This sorts all the processes by memory size. Look for a program that constantly grows and never shrinks.

Usually these questions come up when all memory is used up -- seldom the result of a memory leak, but inadequate RAM sizing for the applications and users.


Bill Hassell, sysadmin