First, let’s take a look at the general situation of jvm, including: heap memory usage, loaded classes, number of threads, and other information. As shown in the figure below:
Then take a look at the memory usage of jvm seen through jconsole. jvm mainly manages two types of memory: heap and non-heap. Simply put, the heap is the memory that is accessible to Java code, which is reserved for developers; non-heap is reserved for JVM for itself. All method areas, memory required for internal processing or optimization of JVM (such as JIT compiled code cache), each class structure (such as runtime constant pool, fields and method data), and the code of method and constructor are in non-heap memory. In jconsole we see the memory status of each part as shown in the green bar chart below. In jconsole, the heap memory of jvm is divided into: eden space memory pool, survivor space memory pool, tenured gen memory pool, and non-heap memory is divided into: code cache memory pool, and perm gen memory pool. As shown in the figure below:
Finally, let’s use jconsole to check the parameter settings of jvm, as shown in the figure below:
The above jvm parameters are as follows:
-Xms Minimum heap space
-Xmx Maximum heap space
-Xmn New Generation Space
-Xss thread stack space
-XX:PermSize=xxx Permanent generation space
-XX:MaxPermSize=xxx Maximum permanent generation space