JVM Memory model - Java
JVM Architecture
Following diagram summarizes the key components in a JVM. In the JVM architecture, two main components that are related to garbage collection are heap memory and garbage collector. Heap memory is the runtime data area where the instances will be store and the garbage collector will operate on. Now we know how these things fit in the larger scheme.

Java Heap Memory
It is essential to understand the role of heap memory in JVM memory model. At runtime the Java instances are stored in the heap memory area. When an object is not referenced anymore it becomes eligible for eviction from heap memory. During garbage collection process, those objects are evicted from heap memory and the space is reclaimed. Heap memory has three major areas,
- Young Generation
- Eden Space (any instance enters the runtime memory area through eden)
- S0 Survivor Space (older instances moved from eden to S0)
- S1 Survivor Space (older instances moved from S0 to S1)
- Old Generation (instances promoted from S1 to tenured)
- Permanent Generation (contains meta information like class, method detail)

Update: Permanent Generation (Permgen) space is removed from Java SE 8 features.
Source: http://javapapers.com/java/java-garbage-collection-introduction/
Comments
Post a Comment