views:

107

answers:

4

Hey,

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 avoid this

Thanks Rohan

+1  A: 

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

Bivas
+1  A: 

add this

-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=128m
org.life.java
+1  A: 

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.

duffymo
+1 - reality bites
Stephen C
A: 

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

ksm