Eclipse crash. error message:
MyEclipse has detected that less than 5% of the 64 MB of Perm
Gen (Non-heap memory) space remains. It is stronugly recommended
That you exit and restart MyEclipse with new virtual machine memory
Paramters to increase this memory. Failure to do so can result in
Data loss. The recommended Eclipse memory parameters are:
Eclipse.exe-vmargs-Xms128M-Xmx512M-XX: PermSize = 64 M-XX: MaxPermSize = 128 M
1. Parameter meaning
-Vmargs-Xms128M-Xmx512M-XX: PermSize = 64 M-XX: MaxPermSize = 128 M
-Vmargs indicates that VM parameters are followed, so the following are actually JVM parameters.
-Xms128m heap memory initially allocated by JVM
-Xmx512m maximum heap memory that can be allocated by JVM, which can be allocated as needed
-XX: PermSize = 64 M non-heap memory initially allocated by JVM
-XX: MaxPermSize = 128 M maximum non-heap memory that can be allocated by JVM, which is allocated on demand
First, let's take a look at the JVM memory management mechanism, and then explain the meaning of each parameter.
1) Heap and Non-heap memory
According to the official statement: "A Java virtual machine has a heap. The heap is the runtime data area, and the memory of all class instances and arrays is allocated from this place. The heap is created when the Java Virtual Machine is started ." "Memory outside of the heap in JVM is called Non-heap memory )".
JVM manages two types of memory: heap and non-heap. In short, heap is the memory available for Java code and is reserved for developers. Non-heap is reserved for JVM, therefore, the method area, JVM internal processing or optimization of the required memory (such as the code cache after JIT compilation), each class structure (such as the runtime data pool, field and method data) the methods and constructor code are all in non-heap memory.
Heap Memory Allocation
The initial heap memory allocated by JVM is specified by-Xms. The default value is 1/64 of the physical memory. The maximum heap memory allocated by JVM is specified by-Xmx. The default value is 1/4 of the physical memory. By default, when the free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of-Xmx is reached;
When the free heap memory is greater than 70%, the JVM will reduce the minimum heap-to-Xms limit. Therefore, the server generally sets-Xms and-Xmx to be equal to each other to avoid adjusting the heap size after each GC.
NOTE: If-Xmx is not specified or the value is too small, the application may cause a java. lang. OutOfMemory error. This error is from JVM, not Throwable, and cannot be captured using try... catch.
Non-heap memory allocation
JVM uses-XX: PermSize to set the non-heap memory initial value. The default value is 1/64 of the physical memory. The maximum non-heap memory size is set by XX: MaxPermSize. The default value is 1/4 of the physical memory. (Also, the default value of MaxPermSize is related to the-server-client Option,
-In the server option, the default MaxPermSize is 64 MB, and in the-client option, the default MaxPermSize is 32 MB. I have no experiments .)
In the preceding error message, PermGen space stands for Permanent Generation space, which is the Permanent storage area of the memory. We haven't figured out whether PermGen space belongs to non-heap memory or non-heap memory, but at least it belongs.
XX: When MaxPermSize is set too small, java. lang. OutOfMemoryError: PermGen space is the memory benefit. PermSize and MaxPermSize indicate that the virtual machine allocates memory restrictions for the Permanate generation objects such as class objects and method objects, these memories are not included in Heap (Heap memory.
Let's talk about why the memory benefits:
(1) This Part of memory is used to store Class and Meta information. When the Class is loaded, it is placed in the PermGen space area, which is different from the Heap area where the Instance is stored.
(2) GC (Garbage Collection) does not clean the PermGen space during the main program running period. Therefore, if your APP loads many classes, the PermGen space error may occur.
This error is common when the web server pre-compile the JSP.