Memory Leak in Java

What is memory leak in java? How to find it? and how to solve the memory leak?

Actually there is  not to worry about the memory leak in Java.

It is handled by Garbage Collector in Java.

But sometimes if there is java.lang.OutOfMemoryError Exception , memory leak is certainly strong suspect.

IF any application eats more & more system memory and never seems to return memory back to the system untill large amount ot physical memory allocation to that application then this is the sign of memory leak.

Also there is a common problem when we register a class as an event listener without bothering to unregister when the class is no longer needed.

Some Memory debugging programs can come in handy when you're trying to detect memory leaks. These r better that task manager.

We can prevent memory leaks by watching for some common problems. Collection classes, such as hashtables and vectors, are common places to find the cause of a memory leak. This is particularly true if the class has been declared static and exists for the life of the application. and many times member variables of a class that point to other classes simply need to be set to null at the appropriate time.

Nikhil Sonurlekar

Related:

Java Books
Java Certification, Programming, JavaBean and Object Oriented Reference Books

Return to : Java Programming Hints and Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.