JMX memory management

jconsole application is shipped since the Java Sun JDK 1.5 in the bin directory

can set properties on jvm using jinfo

%JAVA_HOME%\bin\jinfo.exe -flag PermSize

Used: the amount of memory currently used, including the memory occupied by all objects, both reachable and unreachable. Committed: the amount of memory guaranteed to be available for use by the Java VM. (Committed memory: Total amount of memory allocated for use by the heap.) Max: the maximum amount of memory that can be used for memory management. GC time: the cumulative time spent on garbage collection and the total number of invocations.

Heap
Heap memory is the runtime data area from which the JVM allocates memory for all class instances and arrays. The heap may be of a fixed or variable size. The garbage collector is an automatic memory management system that reclaims heap memory for objects.

non-Heap
Non-heap memory includes a method area shared among all threads and memory required for the internal processing or optimization for the JVM. It stores per-class structures such as a runtime constant pool, field and method data, and the code for methods and constructors. The method area is logically part of the heap but, depending on implementation, a JVM may not garbage collect or compact it. Like the heap, the method area may be of fixed or variable size. The memory for the method area does not need to be contiguous.

In addition to the method area, a JVM implementation may require memory for internal processing or optimization which also belongs to non-heap memory. For example, the JIT compiler requires memory for storing the native machine code translated from the JVM code for high performance.

Committed
Committed: the amount of memory guaranteed to be available for use by the JVM. The amount of committed memory may change over time. The Java virtual machine may release memory to the system and committed could be less than the amount of memory initially allocated at startup. Committed will always be greater than or equal to used.

Used
Used: the amount of memory currently used. Memory used includes the memory occupied by all objects including both reachable and unreachable objects.

Max
Max: the maximum amount of memory that can be used for memory management. Its value may change or be undefined. A memory allocation may fail if the JVM attempts to increase the used memory to be greater than committed memory, even if the amount used is less than or equal to max (for example, when the system is low on virtual memory).

Permanent Generation
Permanent Generation memory pool is the area of heap that loads all the reflective data of the Virtual machine itself, such as class and method objects.

Configuring the size of the Permanent Generation can be important for applications that dynamically generate and load a very large number of classes such as servlets.

Usually a sign that this parameter must be changed occurs when an OutOfMemory: Perm gen Space occurs.

option -XX:MaxPermSize= ; which by default allocates up to 64MB.