2

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

Andrzej Doyle
  • 102,507
  • 33
  • 189
  • 228
Rohan Bomle
  • 51
  • 1
  • 2
  • 6

5 Answers5

8

add this

-XX:+UseConcMarkSweepGC
-XX:+CMSPermGenSweepingEnabled
-XX:+CMSClassUnloadingEnabled
-XX:MaxPermSize=128m
jmj
  • 237,923
  • 42
  • 401
  • 438
  • I added these options under Netbeans: Tools > Servers > Deployment then the Platform tab, in the 'VM Options' field. Hopefully this works... I'll delete this comment if it does not. – nasty pasty Aug 08 '11 at 04:38
2

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
  • 401
  • 4
  • 12
1

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

Bivas
  • 1,484
  • 1
  • 11
  • 17
1

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
  • 305,152
  • 44
  • 369
  • 561
0

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.