Test Suite execution gives Reporting Memory error

Hi

the test suite collection is giving me errors. (Working fine 2 days back)

Do I need to delete previous reports from Katalon ?
If deleted will it be remain on testops ?

There is insufficient memory for the Java Runtime Environment to continue.
Native memory allocation (malloc) failed to allocate 1827520 bytes for Chunk

--------------- T H R E A D ---------------

Current thread (0x0000000018c45000): JavaThread “C2 CompilerThread0” daemon [_thread_in_native, id=6372, stack(0x00000000193e0000,0x00000000194e0000)]

Stack: [0x00000000193e0000,0x00000000194e0000]
[error occurred during error reporting (printing stack bounds), id 0xc0000005]

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code

Hi @gsp,

You can keep the report and manually upload it to TestOps if Katalon Runtime Engine didn’t upload due to insufficient memory in your computer.

To prevent this issue, you should open the kataloc.ini file and change -Xmx2048m to -Xmx4g or -Xmx8g. You should also close unused applications, observe the memory usage of KRE when running KRE with a heavy test suite colletion.

Increasing the heap size is a bad solution, 100% temporary, because you will hit the same issue if you get several parallel requests or when you try to process a bigger file. Normally this is a runtime error in Java which occurs when you allocate a new object in your application over a period of time continuously and the Garbage Collector (GC) cannot make space available to accommodate a new object, and the heap cannot be expanded further, which resulted this error.

Therefore you pretty much have the following options:

  • Find the root cause of memory leaks with help of profiling tools like MAT, Visual VM , jconsole etc. Once you find the root cause, You can fix this memory leaks.
  • Optimize your code so that it needs less memory, using less big data structures and getting rid of objects that are not any more used at some point in your program.

To avoid OutOfMemoryError, write high performance code:

  • Use local variables wherever possible.
  • Release those objects which you think shall not be needed further.
  • Avoid creation of objects in your loop each time.

@gsp

You wrote:

1827520 bytes is 1828m bytes, which is close enough to -Xmx2048m which is the default value preset in the katalon.ini. So I think that @duyluong’s suggestion is valid:

Please imagin, you could somehow decrease the byte size of the report files, which would be transfered from your PC to TestOps, from 1828m to 300m. Then you will see no more OutOfMemoryError. Smaller files will be transfered more quickly ; a favorable side-effect.

But, how can you decrease the file size? I have an idea for @gsp to try.

As described in View and Customize Execution Log, you can disable “step execution log” if you are a paying Katalon Studio Enterprise user (unfortunately the free version does not allow you to).

If you disable taking step execution log, the size of the execution0.log file will become far smaller.

I am not sure how much this is effective for you, @gsp. Please try.