We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image rendering and memory leak

Hi!

For our purpose we need to extract figures (pictures, charts, etc) from many Word documents and render its as images.
The Aspose.Words product help us but after some time of work of our application we receive the error: java.lang.OutOfMemoryError: Java heap space.
We have write the simple test (see attachment) that works but not for long.
We have monitored the proceess with VisualVM and found that count of objects of types char[], String and sun.font.TrueTypeFont$DirectoryEntry () is growing.

--
Best regards,
Peter Titov
Hi Peter,

Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for Java 16.11.0 and have not found the shared issue. Please use Aspose.Words for Java 16.11.0. Hope this helps you.
Hi Tahir,

I've tested version 16.11.0 and received the same result. The test failed with 'OutOfMemoryError: Java heap space' exception after six iterations. Please try the next JVM options for quick result: -Xmx100m.

--
Best regards,
Peter Titov

Hi Peter,


Thanks for your inquiry. We have tested the scenario using latest version of Aspose.Words for Java 16.11.0 at Windows 7 and have not found the shared issue.

Sometimes Aspose.Words for Java will throw OutOfMemoryError on Java. This is because the default Java heap space might not be enough for high memory spikes when processing some documents. In this case, the easy way to workaround is to increase the heap space for the JVM.

Hi,


Please see the attachement. It is part of memory snapshot created by YourKit Java Profiler. It shows that static field zzY6L of class com.aspose.words.zzYTR stores huge strings extracted from the processed documents. There are many other similar classes in Aspose.Words. As a result java heap is growing document by document.

Peter Titov
Hi Peter,

Thanks for your inquiry. Please note that the memory may not be released until a process is completed. You need to increase the heap space for the JVM to fix this issue.

In terms of memory, Aspose.Words does not have any limitations. If you're loading huge Word documents into Aspose.Words' DOM, more memory would be required. This is because during processing, the document needs to be held wholly in memory. Usually, Aspose.Words needs 10 times more memory than the original document size to build a DOM in the memory.

We're always working on improving performance; but, rendering will be always running slower than simple saving to flow formats (e.g. doc/docx).