Showing posts with label Young Generations. Show all posts
Showing posts with label Young Generations. Show all posts

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?


#hemant #kurmi #hemant #kurmi #hemant #kurmi
#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi

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

Hemant Kurmi - What are Java heap Young, Old and Permanent Generations?

The Java heap is divided into two main parts: the Young generation and the Old generation.

Young Generation

The Young generation memory comprises approximately 40% of the maximum Java heap. It is further divided into two sections: Eden space and Survivor space.

Eden Space

Objects are initially created in the Eden space of the Java heap. Most objects die quickly and are cleaned up by minor Garbage Collectors, which run exclusively in the Young generation and have a higher frequency compared to major garbage collectors. Typically, new objects created within a Java method are allocated in Eden space, and their memory is reclaimed once the method execution completes. In contrast, instance variables of a class usually live longer until the object based on that class is destroyed. When Eden space fills up, it triggers a minor collection, moving some surviving objects to the Survivor space or an older generation.

Survivor Space

Survivor space contains objects that have survived garbage collection in the Eden space. The Survivor Ratio parameter can be used to tune the size of the survivor spaces. Setting -XX:SurvivorRatio=6 establishes a 1:6 ratio between each survivor space and Eden. If survivor spaces are too small, copying collection overflows directly into the tenured generation.

Old Generation – Tenured

The Old generation, or Tenured space, contains objects that have persisted for a while in the survivor space. These objects may have a longer lifespan and could be utilized throughout the application's runtime.

PermGen Space

PermGen, or Permanent Generation, is a non-heap memory area where class loading occurs, and the JVM allocates space for classes, class metadata, methods, String pool, and class-level details. PermGen is separate from the heap area, and its size can be adjusted according to requirements using -XX:MaxPermSize and -XX:PermSize JVM options. Garbage collection also takes place in this area of JVM memory, referred to as "Class GC." The Class Garbage Collection can be disabled using the JVM option -noclassgc. If the "-noclassgc" Java option is added while starting the server, PermGen also holds all the reflective data of the virtual machine itself, stores class-level details, loading and unloading classes (e.g., JSPs), methods, and the String pool. However, some JVMs, like JRockit, do not have a PermGen space at all, and everything is stored in the heap. In this context, PermGen can be considered a "special part" of the heap, but otherwise, it is not a part of the heap.
Java heap Young, Old and Permanent Generations






#hemant #kurmi 
#hemant #kurmi #hemant #kurmi
#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant#hemant #kurmi #hemant #kurmi #hemant #kurmi
#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi#hemant #kurmi

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?

Hemant Kurmi - 2021 - Some Amazing Facts About Memory: Petabyte, Exabyte, and Zettabyte

Some Amazing Facts About Memory: Petabyte, Exabyte, and Zettabyte As technology advances, our ability to store and process data has grown ...