GC overhead limit excess | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
0

GC overhead limit excess

i'm doing calculation which needs gigantic iteration (loop function) , and GC overhead limit excess occured. i'm coding in Java.By the way, i ve tried to rewrite same logic in C# and it compiles fast, nothing problem. but i want to make my application works in multiplatform, so i decided to code in Java. help me!

16th Mar 2017, 4:20 PM
Katawari Doki
Katawari Doki - avatar
2 Respostas
+ 10
'The detail message "GC overhead limit exceeded" indicates that the garbage collector is running all the time and Java program is making very slow progress. After a garbage collection, if the Java process is spending more than approximately 98% of its time doing garbage collection and if it is recovering less than 2% of the heap and has been doing so far the last 5 (compile time constant) consecutive garbage collections, then a java.lang.OutOfMemoryError is thrown. This exception is typically thrown because the amount of live data barely fits into the Java heap having little free space for new allocations. Action: Increase the heap size. The java.lang.OutOfMemoryError exception for GC Overhead limit exceeded can be turned off with the command line flag -XX:-UseGCOverheadLimit.' Source: https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/memleaks002.html
16th Mar 2017, 6:29 PM
Tashi N
Tashi N - avatar
+ 10
Probably you receive this error because you are creating huge numbers of objects. Additional to increasing the heap size you should try to refactor your code and check if all the objects have to be created in your loop. Maybe there is a way that doesn't overflow your heap. But this is hard to tell without knowing your code.
16th Mar 2017, 6:32 PM
Tashi N
Tashi N - avatar