Home java OUTOFMEMORYERROR: GC Overhead Limit Exceeded When parameters -XMX8192M -XX: -Usegcoverheadlimit

OUTOFMEMORYERROR: GC Overhead Limit Exceeded When parameters -XMX8192M -XX: -Usegcoverheadlimit

Author

Date

Category

JUNIT Tests work with large amounts of data, in particular, this error occurs when you read the data from the base to the object.

RAM – 16 GB, 4 virtual processors

When an error occurred

java.lang.outofmemorryrror: GC Overhead Limit Exceeded
AT Sun.Reflect.GeneratedConstructoraccessor47.NewinStance (Unknown Source)
AT Sun.Reflect.DelegatingConstructoraccessorImpl.newinstance (delegatingConstructoraccessorimpl.java:45)
at java.lang.reflect.constructor.newinstance (constructor.java:422)
at java.lang.class.newinstance (class.java:442)

I added -XX: -UsegcoverheadLimit
But got the following error:

java.lang.outofmemorryrror: GC Overhead Limit Exceeded
  at java.lang.reflect.field.copy (field.java:150)
  at java.lang.reflect.reflectaccess.copyfield (reflectaccess.java:144)
  AT Sun.Reflect.ReflectionFactory.copyfield (reflectionfactory.java:309)
  at java.lang.class.copyfields (class.java :15)
  at java.lang.class.getfields (class.java:157)
  at main.java.dataformat.dbtable.loadObjectFromResultset (dbtable.java:101)
  at main.java.dataformat.dbtable.getentities (dbtable.java:nd7)

All parameters JVM -XMX8192M -XX: -UsegcoverheadLimit

At the time of the error appeared, the following system parameters were:
RAM stably at 46% (7400MB), CPU 77% -82% (82% at the time of error)

Tell me how to fix this problem?

Sparkke

  1. java.lang.outofmemorryerror: GC Overhead Limit Exceeded

This error may occur both when overflowing the first and
Second regions. It is connected with the fact that the memory remains little and GC
Constantly works, trying to free up a bit of place. This error
can be turned off using the -XX: -Usegcoverheadlimit parameter, but
Of course, it must not be turned off, and either solve the problem of leakage
Memory, or allocate more volume, or change GC settings.

answer
String The object too much weighs. And I have a lot of thongs there. For example, the file that weighs 250 MB, has 1600 characters in a string and 220,000 lines. Fill in ArrayList & LT; String & GT; Lines , where each line is recorded as an object of 250 fields that take a value of 1600 characters. Such an object weighed a little more 6GB .

Solution: increased memory to 14GB . Now the problem is that the 6GB facility does not fit in a heap, it is necessary to think something else and sacrifice the time to perform the test.


Answer 1, Authority 100%

In this case, the java.lang.outofmemorryerror error: GC Overhead Limit Exceeded says that you are trying to process such a data volume that does not fit into memory. The help of your help mentioned that the error is thrown when the memory area occupied only that the objects created are overflowed. Plus, in the trace of the stack it can be seen that your classes (

at main.java.dataformat.dbtable.loadObjectFromResultSet (dbtable.java:101)
at main.java.dataformat.dbtable.getentities (dbtable.java:nd7)

) At the time of receipt of the error just try to unload data from the base.

Therefore, a simple and disappointing output from the above test to a smaller amount of data or select a larger volume under the data (-xmx12000m) if they are placed there, the error will disappear. Customize garbage assembly in this case is useless. GC will not be able to delete downloadable objects because they are still used.


Answer 2, AUTHORITY 78%

Nach with basics for better understanding of the error.

JVM has two memory areas: Heap Memory and non-heap memory .

  • Heap Memory – stores objects;
  • non-Heap Memory – stores the parameters of methods, primitive types, etc.

In your case, the Heap Memory is overflowing, because A lot of objects are created that do not accommodate Heap Memory . You can solve the problem by increasing the HEAP Memory (Key -XMX), which does not always help, because The amount of data may be more than available to RAM, therefore it is better to implement data processing from database portion, i.e. Upload a part of the data so that objects fit in memory, then kill them (assign null to GC unload), will notice the following part, etc.

P.S. It is worth understanding that heap is not RAM . HEAP is only a reserved memory for JVM, more than this JVM reserve cannot even use if RAM in excess.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions