The IBM® JVM requires memory for several different components, including memory regions for classes, compiled code, Java™ objects, Java stacks, and JNI stacks. Some of these memory regions must be in contiguous memory. Other memory regions can be segmented into smaller memory regions and linked together.
Dynamically loaded classes and compiled code are stored in segmented memory regions for dynamically loaded classes. Classes are further subdivided into writable memory regions (RAM classes) and read-only memory regions (ROM classes). At runtime, ROM classes and AOT code from the class cache are memory mapped, but not loaded, into a contiguous memory region on application startup. As classes are referenced by the application, classes and compiled code in the class cache are mapped into storage. The ROM component of the class is shared between multiple processes referencing this class. The RAM component of the class is created in the segmented memory regions for dynamically loaded classes when the class is first referenced by the JVM. AOT-compiled code for the methods of a class in the class cache are copied into an executable dynamic code memory region, because this code is not shared by processes. Classes that are not loaded from the class cache are similar to cached classes, except that the ROM class information is created in segmented memory regions for dynamically loaded classes. Dynamically generated code is stored in the same dynamic code memory regions that hold AOT code for cached classes.
The stack for each Java thread can span a segmented memory region. The JNI stack for each thread occupies a contiguous memory region.
To determine how your JVM is configured, run with the -verbose:sizes option. This option prints out information about memory regions where you can manage the size. For memory regions that are not contiguous, an increment is printed describing how much memory is acquired every time the region needs to grow.
-Xmca32K RAM class segment increment -Xmco128K ROM class segment increment -Xms64M initial memory size -Xmx64M memory maximum -Xmso256K operating system thread stack size -Xiss2K java thread stack initial size -Xssi16K java thread stack increment -Xss256K java thread stack maximum size
This example indicates that the RAM class segment is initially 0, but grows by 32 KB blocks as required. The ROM class segment is initially 0, and grows by 128 KB blocks as required. You can use the -Xmca and -Xmco options to control these sizes. RAM class and ROM class segments grow as required, so you will not typically need to change these options.
Current statistics for cache "sharedcc_j9build": shared memory ID = 103809029 base address = 0xC000DBB8 end address = 0xC1000000 allocation pointer = 0xC00F3340 cache size = 16776892 free bytes = 15536560 ROMClass bytes = 1161532 AOT bytes = 0 Data bytes = 56244 Metadata bytes = 22556 Metadata % used = 1% # ROMClasses = 365 # AOT Methods = 0 # Classpaths = 1 # URLs = 0 # Tokens = 0 # Stale classes = 0 % Stale classes = 0% Cache is 7% full