<AWT Dev> Memory leaks due to static references in AWT & Swing

Roman Kennke roman at kennke.org
Wed Jul 20 00:41:01 PDT 2011


Hi there,

I wonder if those statics shouldn't be AppContext or even instance
fields in the KFM? Static fields just seem wrong.

Regards, Roman

Am Mittwoch, den 20.07.2011, 09:36 +0200 schrieb Jaroslav Tulach:
> Hello.
> My name is Jaroslav Tulach and I working on NetBeans. Recently I started to 
> fight with memory leaks by writing some automated tests to verify that some 
> sequence of actions does not leave a memory behind.
> 
> I think the tests are paying off, we managed to fix many leaks in NetBeans 
> code. However now we are facing an unsolvable problem: there are some 
> (temporary) leaks in AWT and Swing code which cause our tests to randomly 
> fail.
> 
> We tried to workaround the problem (by opening new unrelated windows, or using 
> reflection to clean well known references), but so far our solutions are 
> fragile and the test continue to fail in new, inventive ways (for example 
> https://netbeans.org/bugzilla/show_bug.cgi?id=197905).
> 
> It would be much easier if we could eliminate the (temporary) memory leaks in 
> AWT/Swing code. I am attaching a patch that uses WeakReference instead of 
> strong one that would fix one of our failing test.
> 
> What it would take to accept my patch? Thanks for your advice and help.
> -jt
> 





More information about the awt-dev mailing list