Monday 3 February 2014

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?

No comments:

Post a Comment

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 ...