OutOfMemoryException on subsequent image reads from Aspose.Imaging (after setting size hint)

After the solution here High memory usage on subsequent image reads from Aspose.Imaging - #9 by evgeniy.sidenko, we started to face a new “OutOfMemoryException” instead of the high memory usage which caused the out of memory error from the JVM, so the main problem from the first bug I reported is there but with a different error message after setting the size hint.

Can you please check and suggest a new solution?
Thanks in advance.

Hello, @ahashem!
Are you using the same code as in High memory usage on subsequent image reads from Aspose.Imaging?
If no, could you share the code causing OutOfMemory, the inputs and product version?

I am using the same code.

@ahashem, could you also point out the version you are currently using? Let us take some time to investigate the issue.

The version is: 21.10

Hi, @ahashem
Causing the OutOfMemoryException may be due to the intensive processing of imaging with high resolution. The garbage collector may not work as fast as needed. Sometimes it is useful to call GC.collect() from time to time.