如何清除permgen内存空间 [英] How to clear permgen memory space
问题描述
我正在使用MAT分析内存.
I am using MAT to analyze memory.
Size: 14.4 MB Classes: 7k Objects: 350.9k Class Loader: 116
我已经使用MAT内存分析仪获得了以上报告.但是我找不到清除这些类,对象的任何方法.
有什么方法可以删除所有这些对象并清理permgen内存.
我们可以清理permgen内存还是我必须增加eclipse.ini
文件中的xms, xmx and launcher.XXMaxPermSize
大小,并确保使用后所有对象都为空.
I've got the above report using MAT memory analyzer. But I can't find any way to clear those classes, objects.
Is there any way to remove all those object and clean permgen memory.
Can we clean permgen memory or I have to increase xms, xmx and launcher.XXMaxPermSize
size in eclipse.ini
file and make sure all object are nullify after use.
推荐答案
据我所知,没有清除permgen的功能.默认情况下,jvm无限期保留所有已加载的类.但是您可以使用-XX:+CMSClassUnloadingEnabled
和-XX:+UseConcMarkSweepGC
参数更改此行为.
As far as I know there is no function that clears permgen. On default, jvm holds all the loaded classes indefinitely. But you can change this behaviour using -XX:+CMSClassUnloadingEnabled
and -XX:+UseConcMarkSweepGC
parameters.
如果使用CMSClassUnloadingEnabled
参数,GC还将清除PermGen并删除不再使用的类.
If you use CMSClassUnloadingEnabled
parameter the GC will also sweep PermGen and remove classes which are no longer used.
这篇关于如何清除permgen内存空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!