ClassLoader泄漏 - 他们值得解决吗? [英] ClassLoader Leak - Are they worth solving?

查看:209
本文介绍了ClassLoader泄漏 - 他们值得解决吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ClassLoader 泄漏通常会导致 java.lang.OutOfMemoryError:PermGen 。在处理应用程序服务器的过程中,您可能会看到这是许多重新部署常见应用程序的结果。可以在这两个链接上看到对此问题的解释和可能的解决方案。 (其中包括)

ClassLoader leaks usually result in java.lang.OutOfMemoryError: PermGen. In the instance of working on application servers you may see this as a result of many redeploys of a common application. The explanation and possible resolutions to this problem can be seen on these two links. (among others)

http://dev.eclipse.org/blogs/memoryanalyzer/2008/05/17/the-unknown-generation-perm/
http://blogs.oracle.com/fkieviet/entry/classloader_leaks_the_dreaded_java

现在大部分时间都很容易搞定。只需增加-XX:MaxPermSize,当不可避免的情况发生时,完全重启JVM。尝试解决这个问题的问题是,在大型应用程序中,许多类可能导致类加载器泄漏,因此类仍然保留在permgen中。

Now for the most part they are easy to get around. Simply increase the -XX:MaxPermSize and when the inevitable happens, restart the JVM completely. The problem with trying to solve this is that in large applications many classes can cause the classloader to leak and thus the classes to stay within the permgen.

由此产生两个问题:

说这样的问题比仅仅更好是否合理增加最大烫发大小并在必要时重新启动或者找到更高优先级的解决方案?

Is it reasonable to say that an issue like this is better to just increase the max perm size and restart where necessary or should finding a resolution be a higher priority?

是否有更简单的方法来解决类加载器泄漏问题?

Are there easier ways to resolve a classloader leak?

推荐答案

它实际上取决于应用程序,或者更确切地说,取决于所使用的部署过程。许多应用程序仅在开发期间进行了重新调整,新版本每隔几个月发生一次,并且应用程序服务器因其他原因重新启动,远远超过部署应用程序。在这种情况下,追逐Classloader泄漏是浪费时间。

It really depends on the application, or rather, the deployment process being used. Many applications are only ever redeplyoed during development, new releases happen once every few months, and the application server is restarted for other reasons far more often than the app is deployed. In those circumstances, chasing Classloader leaks is a waste of time.

当然,如果您计划实施持续部署过程,特别是在高可用性环境中,然后Classloader泄漏是您真正需要解决的问题。但是,在成为问题之前,还有许多其他事情需要比大多数项目做得更好。

Of course, if you plan on implementing a continuous deployment process, especially in a high-availability environment, then Classloader leaks are something you really need to tackle. But there are a lot of other things you need to do better than most projects before that becomes an issue.

这篇关于ClassLoader泄漏 - 他们值得解决吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆