Application/Library is Leaking Memory

What does it mean when somebody says that the application/library is leaking memory?

----------------------------------------------------------------

===. In very general terms it refers to allocating but not releasing the memory.

Memory leaks are hard to detect. Sometimes you may allocate in a library and free it up in application, but when you run
profiling tools w.r.t library they will detect memory leak, which may not be correct. But if you're not freeing it up in your app,
you'll just waste this peice of memory and it will be classified as leak.

Memory leaks are more cause of concern to system programs and application daemons that run thru the lifetime of the system,
than those apps which come around one a while and go away after finishing whatever they're supposed to do.

Some leaks are deliberately introduced by programmers. For issues like you want to gather stats you can allocate a list and
never free it up, since you want all the stats to be there. Rpcbind does that, but that cannot be classified as a leak since we
know what we're doing.

In DEC it is a memory leak to free a non allocated peice of memory or in HP to free 2wice with compiler/malloc checking
turned on.

Serious memory leaks can cause system to swap or even halt. Something like char *array[1024*1024] is a huge BSS and a
memory leak, though most compiler will not compile such codes, this is an extreme situation example. You will not want to do
this even knowingly.

Memory leaks also cause lag in program performance and accumlate the program resident size. There was this HP application
that would back up to tapes within 5 minutes flat and if the service was left on the system for more than 4 days, it would take
more than 48hours to backup even one file, is a classic example of performance drain w.r.t appliation.

Hope this clears up!!

Have a Unix Problem
Do you have a UNIX Question?

Unix Books :-
UNIX Programming, Certification, System Administration, Performance Tuning Reference Books

Return to : - Unix System Administration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.
The site www.gotothings.com is in no way affiliated with or endorsed by any company listed at this site.
Any unauthorised copying or mirroring is prohibited.