jUnit tests work with large amounts of data, in particular, this error occurs when we read data from the database to the object.
RAM - 16 GB, 4 virtual processors
when an error occurred
java.lang.OutOfMemoryError: 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) then I added the -XX:-UseGCOverheadLimit parameter -XX:-UseGCOverheadLimit but got the following error:
java.lang.OutOfMemoryError: 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:3115) at java.lang.Class.getFields(Class.java:1557) at main.java.DataFormat.DbTable.loadObjectFromResultSet(DbTable.java:101) at main.java.DataFormat.DbTable.getEntities(DbTable.java:57) all parameters of JVM -Xmx8192M -XX:-UseGCOverheadLimit
at the time of error, the following system parameters were: RAM is stable at 46% (7400MB), CPU 77% -82% (82% at the time the error occurred)
tell me how to fix this problem?
Sparvka
- java.lang.OutOfMemoryError: GC overhead limit limit exceeded
This error may occur as if the first and second areas overflow. It is connected with the fact that the memory is low and the GC is constantly working, trying to free up some space. This error can be disabled using the -XX parameter: -UseGCOverheadLimit, but, of course, it should not be disabled, and either solve the problem of memory leakage, or allocate more volume, or change the GC settings.
AnswerString object weighs too much. and I have a lot of strings there. For example, they counted a file that weighs 250 MB, has 1600 characters per line and 220,000 lines. I fill in ArrayList<String> lines , where each line is written as an object of 250 fields that take a value of 1600 characters. Such an object weighed a little more than 6Гб .
Solution: increased memory to 14Гб . Now the problem is that the 6GB object doesn't fit on the heap, you need to think something else and sacrifice the test execution time.
