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

Free Support Forum - aspose.com

Memory leak when converting from doc to pdf

I have observed memory leak in application while converting from word to pdf. In the following link https://gist.github.com/rebizant/5655622 I attached sample code and also example doc file.When I ran the example code, after about 500 iterations , outOfMemoryError have been threw (-Xmx1024m, jdk_1.7.0_021, Aspose.Words.jdk16 version

After investigating heap dump, I noticed that over 85% of memory is reserved by com.sun.imageio.plugins.jpeg.JPEGImageReader instances. Maybe I didn’t invoke some kind of release method ? or library didn’t release resources ? ( according documentation, after JPEGImageReader is used, it is mandatory to invoke release method because : “

    It is important for applications to call this method when they know they will no longer be using this ImageReader (or subclass). Otherwise, the reader may continue to hold on to resources indefinitely.

    The default implementation of this method in the superclass does nothing. Subclass implementations should ensure that all resources, especially native resources, are released.”


Hi Tomasz,

Thanks for your inquiry.

After an initial test with Aspose.Words for Java 13.4.0, I was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. 13.4.0. You can download it from the following link:

I hope, this helps.

Best regards,

I have ran few tests and I found out, that the java is the problem, I’ve tested on version 1.7.0_21 ( memory leak) and on version 1.7.0_04 ( no error), so problem is not Aspose library .

Hi Tomasz,

It's great you were able to find what you were looking for. Please let us know any time you have any further queries.

Best regards,