Java 11 and 12 by Mala Gupta

Java 11 and 12 by Mala Gupta

Author:Mala Gupta
Language: eng
Format: epub
Tags: COM051280 - COMPUTERS / Programming Languages / Java, COM051210 - COMPUTERS / Programming / Object Oriented, COM051010 - COMPUTERS / Programming Languages / General
Publisher: Packt Publishing
Published: 2019-03-25T13:29:24+00:00


ZGC heap

ZGC divides memory into regions, also called ZPages. ZPages can be dynamically created and destroyed. These can also be dynamically sized (unlike the G1 GC), which are multiples of 2 MB. Here are the size groups of heap regions:

Small (2 MB)

Medium (32 MB)

Large (N * 2 MB)

ZGC heap can have multiple occurrences of these heap regions. The medium and large regions are allocated contiguously, as shown in the following diagram:

Unlike other GCs, the physical heap regions of ZGC can map into a bigger heap address space (which can include virtual memory). This can be crucial to combat memory fragmentation issues. Imagine that you can allocate a really big object in memory, but you can't do so due to unavailability of contiguous space in memory.

This often leads to multiple GC cycles to free up enough contiguous space. If none are available, even after (multiple) GC cycle(s), your JVM will shut down with OutOfMemoryError. However, this particular use case is not an issue with the ZGC. Since the physical memory maps to a bigger address space, locating a bigger contiguous space is feasible.

ZPages are a multiple of the same number, say, 2 MB on an Intel machine. It could vary, to, say, 4 MB on an S machine.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.