Navigation

Monday, 3 February 2014

What is a Memory Leak in java?



Definition 1:-Unable  to release unreachable memory, which can no longer be allocated to new  process during execution of allocating process. It can mostly be cured by using GC techniques or detected by automated tools.

Definition 2:-Unable to release reachable memory, which is no longer needed for your program to function correctly. It is nearly impossible to be detected by automated tools or programmers who is not too familiar with the code. While technically it is not a leak, because according to GC it is useful to you and will not clear it.

Definition 3:-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

So memory leak is like leakage in water tank the quantity of water will decreased day by day. And you will suffer with lack of quantity.


Now talking about on basic what is a leak let you have 20 water glass in you house and when you need you use them and when servant comes he will clean all the used water glasses and will keep in stand for future use. Now if you drink water and keep the used glass in other rooms where servant is not permitted to enter then they will be left uncleaned or you kept the water glass on table with some water then servant will think that you are using it and will not take that glass from your table. 

So the quantity will decrease from 20 to 18 . and if this continues then a day will come when you will search all the water glasses and will ask servant to clean. In java this servant is know as GARBAGE COLLECTOR


You may also like:-

How to Reduce Garbage-Collection Pause Time?

4 Mains causes of Long Garbage Collection Pause?

How Application Performance get impacted by Garbage Collection?

Java Performance Tuning options Java heap

Why Memory leak in Java ?

What is a Memory Leak in java?

What is Garbage collector in java and how it works?

What is Garbage Collector Compaction in Java?

What are Java heap Young, Old and Permanent Generations?

What is difference between Web Server and Application Server ?

What is the maximum ram for 32 bits and 64 bits computer?

Some Amazing fact about memory (petabyte,exabyte,zettabyte) And How much data exists on the Web?