本文介绍了导致java.lang.OutOfMemoryError的算法:PermGen空间错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Sun JVM(1.6.0_21-b06)上收到PermGen空间错误(好吧,它是Oracle :)).增加选项-XX:MaxPermGen值无济于事.我知道PermGen是一个空间,用于存放类元数据之类的永久对象.项目中的类数量不是那么大,大约为1万个.在崩溃之前,jvisualvm显示57MB为Used PermGen.

I am getting PermGen space error on Sun JVM (1.6.0_21-b06) (Ok, it's Oracle :)). Increasing of option -XX:MaxPermGen value does not help. I know that PermGen is a space intended for permanent objects like class metadata. Count of classes in project is not so big ~ 10 000. Before crash jvisualvm shows 57MB as Used PermGen.

我猜想某些算法会占用所有可访问的内存.有人知道导致PermGen溢出的算法示例吗?

I guess that some algorithm occupies all accessible memory. Does someone know examples of algorithms that lead to PermGen overflow ?

UPD.我问这样的抽象问题,因为此刻我无法使用任何探查器-代码崩溃非常严重,jvisualvm和eclipse停止响应.我需要使用kill -KILL {process_numer}从终端杀死Java进程.我使用的是有很多线程和JMS消息传递的不良组织(但商业)代码.调试是一团糟-首先我需要了解在哪里查看.

UPD. I ask such abstract question, because in the moment I can not use any profiler - code crashes so hard that jvisualvm and eclipse stop to respond. I need than kill java processes from terminal with kill -KILL {process_numer}. I work with bad organized (but commercial) code that has many threads and JMS messaging. Debugging is a mess - I need some idea first where to look.

推荐答案

是的,但是这有什么意义呢?如果要解决此问题,请安装内存分析器工具(例如jprobe或lambda探针),并检查发生内存泄漏的位置,然后进行修复.现在举个例子:有成千上万种超越烫发空间的方法.当我们继承了他们使用JMS的应用程序时,我注意到了一个项目. jms连接保持打开状态,在收到许多带有类似错误的请求的应用程序后,该应用程序在几分钟之内崩溃.需要指出的是:当我们从jboss(移至beajrockit)迁移到weblogic时,它出人意料地修复了自身或至少承担了技术债务的打击.我的建议与之无关,应该先修复具有内存泄漏的错误代码,然后再修改应用程序服务器和堆空间分配参数.

Yes but what is the point of this? if you want to fix this install a memory profiler tool like jprobe or lambda probe and check where the memory leak is happening, and fix that.Now for the example: There are thousands of ways to exceed perm gen space. I had noticed on a project when we inherited an application where they were using JMS. The jms connections were left open, the application crashed within a few minutes after it got a lot of requests with a similar error like you are getting. Point to note: when we moved to weblogic from jboss (moved to beajrockit) amazingly it fixed itself or atleast took the blow of technical debt. My advice would be irrespective of this, bad code with memory leaks should be fixed first, then tinker with app servers and heap space allocation paramters.

这是一个有用的链接,其中包含有关您所获取的异常的一些信息. http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang

Here is a useful link with some information on the exception you are getting.http://www.jroller.com/agileanswers/entry/preventing_java_s_java_lang

编辑

此链接可能会有所帮助 http://www.precisejava.com/javaperf/j2ee/JMS.htm

This link may be helpfullhttp://www.precisejava.com/javaperf/j2ee/JMS.htm

这篇关于导致java.lang.OutOfMemoryError的算法:PermGen空间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 12:11