解决PermGen问题的各种选项 [英] The various options for solving PermGen problems
问题描述
- 自己的上的VM选项不会解决此问题,只会推迟它。
- 解决此问题的唯一可靠方法是修复编码错误在Application Server本身(不太可能)或在Application Server中运行的代码(我们的代码或第三方库)(更可能)。 Permgen的填充通常是由应用程序类加载器加载到Application Server类加载器加载的对象的引用的结果,从而防止垃圾回收应用程序的类加载器。
我有两个问题产生于此:
- 以上是否正确?
- VM选项
CMSClassUnloadingEnabled
和CMSPermGenSweepingEnabled
在哪里?从我可以看到CMSClassUnloadingEnabled
取代或隐式启用CMSPermGenSweepingEnabled
。它们中的任何一个都可以帮助解决上述问题?
不幸的是,答案是:
- 是
- 这些VM选项只会推迟问题。
基本的问题是GC不会垃圾收集一个强烈可达的对象。你需要弄清楚为什么这些旧的应用程序类加载器在重新部署后仍然可以访问并修复泄漏。
或者,放弃热调整生产服务器,或更频繁地重新启动Web容器(例如JBoss)。
I am looking into the various options around garbage collection on a Java 6 18 VM and would like some pointers.
We run our application on JBoss, and occasionally there are the infamous PermGen errors during redeploys. There is a lot of conflicting and obsolete information on the internet about the best way to solve or mitigate this problem.
From what I can see, the following is correct:
- VM options on their own will not resolve this issue, only postpone it.
- The only reliable way to fix this problem is to fix coding errors either in the Application Server itself (unlikely) or the code (our code or third-party libraries) that is running in the Application Server (more likely). The filling of Permgen is often the result of references from objects loaded by the application classloader to objects loaded by the Application Server classloader, thus preventing garbage collection of the application's classloader.
I have two questions resulting from this:
- Is the above correct?
- Where do the VM options
CMSClassUnloadingEnabled
andCMSPermGenSweepingEnabled
come into this? From what I can seeCMSClassUnloadingEnabled
supercedes or implicitly enablesCMSPermGenSweepingEnabled
. Do either of them help with the above problem?
Unfortunately, the answers are:
- Yes
- Those VM options will only postpone the problem.
The basic problem is that the GC will not garbage collect a strongly reachable object. You need to figure out why those old application class loaders are still reachable after a redeploy ... and fix the leak.
Alternatively, give up on hot redeployment on your production servers, or restart the web container (e.g. JBoss) more often.
这篇关于解决PermGen问题的各种选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!