Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Java.lang.outofmemoryerror: permgen/meta space

Shulou Source: shulou.com Published: 2022-06-03 04:25:36 11月25日 Update

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.

Tags: Permanent memory cause garbage physics program space error maximum function parameter size application suggestion method time maximum mechanism fundamental phenomenon Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker NVidia macOS OPPO Reno vpn