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

Free Support Forum - aspose.com

Leaking ThreadLocal after loading document with image in webapp


Aspose Java Version: 18.4
Apache Tomcat Version: 8.5.27
Java Version: 1.8.0_161

I have a problem undeploying a web application. The web application loads a document. The document contains an image. After undeploy the web application, not all references are closed. The behavior cannot reproduce without the image.
A sample web application is attached. TestApp.zip (48.3 KB)


  1. Deploy web application in Tomcat Web Application Manager. image1.png (52.3 KB)
  2. Open “/TestApp” - the document from the application is loaded.
  3. Undeploy “/TestApp” in Tomcat Web Application Manager. image2.png (56.9 KB)
  4. Open Tomcat-process in Java VisualVM and perform GC and save the heap dump. image3.png (31.1 KB)
  5. Open heap dump with Eclipse Memory Analyzer.
  6. Open the histogram and search “WebappClass”. image4.png (13.0 KB)
    There should be 5 instances of the ParallelWebappClassLoader, but there are 6 (each time the web application is undeployed, one more is added).
  7. There is one instance of the ParallelWebappClassLoader whose state is “after_destroy”. image5.png (58.7 KB)
  8. If you look at “path to GC root”, you can see that there are still references from type DecimalFormat in an Aspose class. image6.png (55.0 KB)

If you need further information, just ask.

Kind regards
Ingo Gutzeit


Thanks for your inquiry. We are working over your query and will get back to you soon.


Thanks for your patience. We have setup the Tomcat web server and followed all steps mentioned in your post. We have not found the shared issue. Please make sure that the step undeploy the web application is performed successfully at your end.

Please note that when the document is closed, all the DOM data is purged from memory during the next garbage collector cycle. The memory may not be released until you close the application.