This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes What is Memory Leakage Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "What is Memory Leakage" Watch "What is Memory Leakage" New topic
Author

What is Memory Leakage

amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
What is Memory leakage in java and how it handles?


Thanks advance who ever answers this question.


regards
amit bhadre
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Memeory Leakage and Memory Managment in Java.
[ March 11, 2006: Message edited by: Chetan Parekh ]

My blood is tested +ve for Java.
amit bhadre
Ranch Hand

Joined: Jan 23, 2006
Posts: 124
Thanks



cheers
amit bhadre
ak pillai
author
Ranch Hand

Joined: Feb 11, 2006
Posts: 288
In Java, typically memory leak occurs when an object of a longer lifecycle has a reference to objects of a short life cycle. This prevents the objects with short life cycle being garbage collected. The developer must remember to remove the references to the short-lived objects from the long-lived objects. Objects with the same life cycle do not cause any issues because the garbage collector is smart enough to deal with the circular references.

--Design applications with an object�s life cycle in mind, instead of relying on the clever features of the JVM. Letting go of the object�s reference in one�s own class as soon as possible can mitigate memory problems. Example: myRef = null;

--Unreachable collection objects can magnify a memory leak problem. In Java it is easy to let go of an entire collection by setting the root of the collection to null. The garbage collector will reclaim all the objects (unless some objects are needed elsewhere).


--Also, take care, while writing singletons, because they are long lived objects.


java j2ee job interview questions with answers | Learn the core concepts and the key areas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is Memory Leakage
 
Similar Threads
Memory Leakage!
advantage of JDBC drivers over JDBC-ODBC bridge
Memory Leakage
How can I found which class and method has memory leakage?
Memory Leakage