Java.lang.outofmemoryerror: permgen/meta space
There is a phenomenon of permanent outofmemory, such as:
Java.lang.OutOfMemoryError: possible causes of PermGen/meta space errors:
1. Lack of space in PermGen
two。 Permanent memory leak
Solution:
1. Set-XX:+CMSClassUnloadingEnabled (must first set-XX:+UseConcMarkSweepGC)
This parameter indicates whether the class unloading feature is enabled when using the CMS garbage collection mechanism. By default this is set to not enabled. If CMSClassUnloadingEnabled is enabled, garbage collection cleans up the persistent generation and removes classes that is no longer in use.
two。 Increase the size of-XX:PermSize and-XX:MaxPermSize
The initial value of the permanent generation, which defaults to 1x64 of the physical memory, the maximum value of the permanent generation, and defaults to 1Comp4 of the physical memory. It is recommended to set it to 128 and 512 respectively.
If it is jdk1.8, set-XX:MetaspaceSize,-XX:MaxMetaspaceSize
3. Troubleshoot memory leaks
There are many reasons why applications encounter java.lang.OutOfMemoryError: PermGen space errors, most of which are caused by the uselessness of references to classes loaded by object or the program's class loader.