Heap memory is divided into primarily two generations: Young Generation and Old Generation. There is a PERM GENERATION that is a part of heap memory until Java 7, while from Java 8, the PERM GENERATION is replaced by METASPACE. METASPACE is not part of the heap memory but is part of the Native Memory. Set size of METASPACE using the -XX:MaxMetaspaceSize option. It is critical to consider this setting when going to production since if METASPACE takes up excessive memory, it affects the application's performance:
The Young Generation is where objects are created and allocated; it's for young objects. The Young Generation is further divided into Survivor Space. The following is the Hotspot Heap Structure:
The eden area is, by default, bigger than Survivor Space. All the objects are created first in the eden area. When eden is full...