1

I have a problem on my VPS. I have a server created with Spring Boot and Java. Initially I have set -Xms default and -Xmx4G. After a lot of call on client this errore appears:

**Exception in thread "https-jsse-nio-80-exec-1743" java.lang.OutOfMemoryError: GC overhead
limit exceeded at java.util.Arrays.copyOfRange(Unknown Source)
    at java.lang.String.<init>(Unknown Source)
        at java.lang.String.substring(Unknown Source)
        at org.apache.tomcat.util.net.AbstractEndpoint.getSSLHostConfig(AbstractEndpoint.java:355)
        at .**

After I have used JMeter and open JMC, I have created 2000 thread of request and I can see that the server works; on the JMC the Heap Space is cleaned by GC, but in the Task Manager the memory of Java is increased and I think the problem is that when the RAM of my VPS increases more. So when tha RAM of my VPS is saturated, Java throws the GC Exception. Can you help me? enter image description here

1 Answer 1

2

This error is thrown by JVM when the application spends 98% of the time in garbage collection. When you create a very large array and keep destroying it - Your memory might be getting cleaned up by GC but GC gets too busy in doing that and JVM raises this error. The task manager shows the rise in memory because even after GC cleaned up the garbage heap, there were array created and lying in the memory that failed to be cleaned. In such a scenario, you need to practically destroy the process and clean up the memory.

You sure must be aware of the fact but would like to mention - The creation of such a large array at any point of time is never a good coding too. It is always good to choose streams or buffered readers to process large data rather than having huge data in heap memory.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks so much. And if I have this error: Exception in thread "https-jsse-nio-80-exec-1749" java.lang.OutOfMemoryError: GC overhead limit exceeded java.lang.OutOfMemoryError: GC overhead limit exceeded ?
Its the same. JVM raises OutOfMemoryError whether GC runs out of memory or you exceed GC's capabilities

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.