1

I am running my application using Java 8, However I have been getting the following error:

java.lang.OutOfMemoryError: GC overhead limit exceeded

I have tried to increase MaxPermSize from 512m to 768 but still I am getting the same error. How can I solve this?

Kavin Chauhan
  • 179
  • 1
  • 17
java123999
  • 5,574
  • 28
  • 66
  • 104

1 Answers1

4

As @Ajan comments, Java 8 doesn't have a "permgen" heap space anymore, and that option will be ignored.

But this isn't a permgen problem at all. In fact, it is most likely a sign that the main Java heap is full. This exception gets thrown if the JVM detects that the GC is taking too large a proportion of the total CPU time over the last few GC cycles. This generally happens because the heap is getting close to full, and the GC is being run more and more frequently.

So, the "quick fix" for the problem would be to increase the main heap size using an -Xmx... option. However, if the real problem is that you have a memory leak, then that is only putting off the inevitable. Unless you already understand why your application is using a lot of memory, you should probably start looking for memory leaks.

Stephen C
  • 632,615
  • 86
  • 730
  • 1,096
  • Thanks for the reply, -Xmx is already set to 1024, should I up it further? What should I up it to? – java123999 Nov 25 '15 at 12:10
  • If you have already increased -Xmx, I would advise looking for the potential memory leak before you increase it again. – Stephen C Nov 25 '15 at 12:13
  • Thanks I will, but id like to see if this fix works in the meantime, what would you suggest increasing it to? – java123999 Nov 25 '15 at 12:14
  • If the problem is a memory leak, then it is irrelevant. It it is not a memory leak ... then "big enough to run your application". But the "right" answer also depends on whether you are using a 32bit or 64bit JVM, and how much free RAM there is. – Stephen C Nov 25 '15 at 12:41