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

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,
  1. Young Generation
    1. Eden Space (any instance enters the runtime memory area through eden)
    2. S0 Survivor Space (older instances moved from eden to S0)
    3. S1 Survivor Space (older instances moved from S0 to S1)
  2. Old Generation (instances promoted from S1 to tenured)
  3. Permanent Generation (contains meta information like class, method detail)
Java-Heap-Memory
Update: Permanent Generation (Permgen) space is removed from Java SE 8 features.

Source: http://javapapers.com/java/java-garbage-collection-introduction/

Comments

Popular posts from this blog

public vs protected vs default access modifiers - Java

Class, Reference and Object