7.6.1 How to save in the New area in Java heap

This subsection describes how to manage objects that exist for a fixed time period, in the New area. In the memory size of the New area, add the memory size for these objects that exist for a fixed time, and then estimate.

If you increase the New area size and prevent the movement of objects to the Tenured area, you can even prevent the occurrence of a full garbage collection. However, since the number of objects in use within the New area increases when executing copy garbage collection, the Copy processing within the New area takes time, and the time taken for executing one copy garbage collection increases. If the execution time of copy garbage collection is longer than the execution time of full garbage collection, you need to re-estimate the memory size. Depending on the setting of memory size, the area being used by the objects with a short lifespan that originally had to be collected by a copy garbage collection, might become insufficient and the objects might get saved in the Tenured area. In such a case, a full garbage collection occurs at the end.

You can use the extended verbosegc information to check whether the objects that exist for a fixed time period can be managed in the New area. Run the application and with the help of extended verbosegc information that is output, ensure that the memory size of the Tenured area does not increase immensely after the occurrence of copy garbage collection.

In case of failure in managing the objects in the New area, the system performance declines immensely. Also, there are limitations for the maximum age of objects managed in the New area (Limitations differ according to the platform and version. For details, see -XX:MaxTenuringThreshold=value of 16.4 Default values of Java HotSpot VM options that can be specified in Cosminexus in the uCosminexus Application Server Definition Reference Guide.). If you realize that the objects are not being managed in New area, consider saving and managing the objects that exist for a fixed time period, in the Tenured area. For details about how to manage objects in the Tenured area, see 7.6.2 How to save in the Tenured area in Java heap.