JVM Memory Assignment

Unofficial Content

How is Memory Assigned?

Initially, the Virtual Machine assigns all objects to the Eden Space. Garbage collection occurs in each generation when it fills up (uses up its allotted memory); the VM performs a partial garbage collection (minor collection) on that memory pool to reclaim memory used by dead objects. The VM moves (promotes) any remaining objects from the Eden Space to one of the Survivor Spaces (promoted to the next older generation). The VM moves objects that live long enough in the Survivor Spaces to the Tenured Space in the old generation. When the tenured generation fills up, there is a full GC (major collection) that is often much slower because it involves all live objects. The permanent generation holds all the reflective data of the virtual machine itself, such as class and method objects.

A generational Collector is free to use a different collection strategy for different generations and perform garbage collection on the generations separately.