开发者

How to avoid java.lang.OutOfMemoryError: PermGen space in Netbeans [duplicate]

This question already has answers here: How can I prevent PermGen space errors in Netbeans? (5 answers) Closed 6 years ago.

I am developing on Web Application in Netbeans6.8 and Using Jboss server to Deploy my application. I am able to run the project properly but after some time i get tgis error

java.lang.OutOfMemoryError: PermGen space :

after that i have to restart my JBoss server. Some time i need to restart my Netbeans IDE Can any one tell me the reason of this error and How to a开发者_运维技巧void this

Thanks Rohan


add this

-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=128m


adding more megs to your heap will not solve your problem, you could add infinity & still run out cuz of sloppy code. more than the issue of JBoss, i suppose that your code most probably has memory leaks in it, since it runs out of heap 'after some time'. its a typical scenario. i suggest that you profile your code using JVisualVM (built-in into SUN JDK6 etc)... have a look at the heap & see what object are have the most instances, total size wise. once you fix those code issue, i dont think you'd want to add more space to your heap.

rgds -ksm


add -XXMaxPermSize=256M to your application start-up command


Bounce your server from time to time. You might not like this limit on your ability to hot deploy, but the problem is that eventually you'll hit the perm gen ceiling again when you redeploy too many times.

Just bounce the server every nth redeploy, where n < # that causes OOM error.


Use this command in your VM:-

Increase the heap size as such:

-Xms256m -Xmx512m -XX:PermSize=64M -XX:MaxPermSize=1000M

These values should be provided to the VM.

after that restart server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜