Memory Command

The memory command shows the amount of memory being used at the time the command is issued. The JVM has a heap that represents the runtime data area from which memory is allocated for all memory requirements. It is created during the JVM start-up. Heap memory for objects is reclaimed by an automatic memory management system, which is known as a garbage collector. The garbage collector runs automatically, but the GC command can be used to force it to run for analysis purposes.

The memory display shows the following components:

Field

Description

init

Represents the initial amount of memory (in bytes) that the JVM requests from the operating system for memory management during startup. The JVM may request additional memory from the operating system and may also release memory to the system over time. The value of init may be undefined (0) on some platforms.

used

Represents the amount of memory currently used.

committed

Represents the amount of memory (in bytes) that is guaranteed to be available for use by the JVM. The amount of committed memory may increase or decrease over time. The JVM may release memory to the system, causing committed to be less than init. However, committed will always be greater than or equal to used.

max

Represents the maximum amount of memory (in bytes) that can be used for memory management. Its value may be undefined. The maximum amount of memory may change over time if defined. The amount of used and committed memory will always be less than or equal to max if max is defined. A memory allocation may fail if it attempts to increase the used memory such that:

used > committed

even if the following would still be true (for example, when the system is low on virtual memory):

used <= max

The heap display is more accurate than the memory display issued without the measurement package installed. The original (standard) information is shown below in addition to the new heap information.

Enter command:>memory
STR00X35: memory used 8244K, free 591K,
        nodes: cache 1001 allocated 8607, reclaimed 116, destroyed 116
        namespace 0 namespace reclaim 0
        Heap: init=0K  committed=8244K  max=65088K  used=7662K
Enter command:>

The key value is the word used, which shows how much is currently allocated. As it approaches max, the garbage collector may start, and the performance may be eroded.