ITeye博客

JEE - Unveiling Java OOM (Out of Memory Error)

vanghoh · 2012-02-03 15:03 · JEE_JVM · 非技术 · Markdown

java.lang.OutOfMemoryError: Perm Space 

Only Oracle(Sun) HotSpot JVM has perm space.

 

java.lang.OutOfMemoryError: Java heap space 
java.lang.OutOfMemoryError: unable to create new native thread 
java.lang.OutOfMemoryError: requested xxxx bytes for Chunk::new. Out of swap space 

java.lang.OutOfMemoryError: GC overhead limit exceeded

 

It’s an alert from JVM and this generally means the GC spends excessive amount of time – by default, 98% of the total CPU time spent for the process – and is able to recover very little memory – less than 2% of the heap.

What to do to resolve this exception?

If you’re executing your own code, you’ve got a tough job at hand – to review your code.

  1. You’re probably creating lots of temporary objects in a loop; See if created object(s) can be reused.
  2. If it’s a genuine requirement, try increasing the max heap size (XmX) in JVM arguments.

I don’t want JVM to throw this alert. Can I disable it?
You can turn this off with the command line option -XX:-UseGCOverheadLimit

More on this here: http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html#par_gc.oom

java.lang.OutOfMemoryError: bitmap size exeeds VM budget

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。