Memory leaks?

Hi!

In our web application we encountered with very strange growing of used memory when use aspose-pdf for java classes (aspose-pdf-4.1.2). Users of application manipulate pdf files in very aggressive manner, but use case is rather simple - just put and remove images on first page of pdf document. Free memory on server finishes rather quickly and application crashes with OutOfMemory error. We’ve got such troubles right after we added this functionality to the server side code.
In attached file I put simple console application(project for Intellij IDEA) which illustrates our approach to place and remove images. Also there is already compiled application in the “distr” folder of project with sample pdf and image files. Just run “java -jar testpdf.jar” and in the “output” folder there will be pdf files we need.
Also I attached two JProfiler reports - one with no any aspose-pdf calls (just message dialog) - for “calibration” purposes to see how simple application work. And the other one is result of 2 pdf files processing.
I realize that our code can be far from ideal, so any workarounds or suggestions how to improve our approach(and still get desired result) are welcome.

I really appreciate any help you can provide.

any suggestions?

In brief, we use
…
doc.getPages().get_Item(pageNum).addStamp (imageStamp);
…
to add image, and
…
doc.getPages().get_Item(1).getResources().getImages().delete(imageName);
…
to delete image from document.
After several such operations we detect huge amount of used memory allocated for aspose.pdf classes, and situation didn’t improved even after garbage collector cycles.
Full source code of sample application is in attached file, see first post in this topic.

Hi Serg,


Thanks for your inquiry.

We are sorry for the inconvenience caused. We are looking into issue and will get back to you soon.

Best Regards,