Bug 51687 - Improve JreMemoryLeakPreventionListener against leak caused by sun.java2d.Disposer
Summary: Improve JreMemoryLeakPreventionListener against leak caused by sun.java2d.Dis...
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 enhancement (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2011-08-19 14:41 UTC by Michał Politowski
Modified: 2014-02-17 13:47 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Michał Politowski 2011-08-19 14:41:36 UTC
The sun.java2d.Disposer class, when loaded, starts an endless daemon thread that can inherit the WebappClassLoader as its context loader. This will cause a leak when the webapp is unloaded.

It would be useful if JreMemoryLeakPreventionListener could load this class to prevent the leak.
Comment 1 Christopher Schultz 2011-08-19 16:51:54 UTC
Which daemon thread?

Is this the same as bug #51688?
Comment 2 Michał Politowski 2011-08-22 08:44:15 UTC
I do not think so. It is a thread named "Java2D Disposer", created in the static initializer of the sun.java2d.Disposer class.
Comment 3 Christopher Schultz 2011-08-22 13:50:27 UTC
Can you post minimal code to cause this thread to be created?

I've just added a fix for that other, somewhat related, bug and I'd be happy to add this as well.
Comment 4 Michał Politowski 2011-08-22 14:12:16 UTC
The exact code that causes it in the webapp at hand is a
sun.java2d.Disposer.getQueue() call
somewhere in the standard JRE library,
but actually just anything that loads the class, even Class.forName("sun.java2d.Disposer"), is enough.
Comment 5 Christopher Schultz 2011-09-20 20:18:41 UTC
Fixed in trunk, 7.0.x branch. Will be included in 7.0.22 onward.