<AWT Dev> Best workaround for OSX Window leak? (JDK-8029147)

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Mon Sep 19 15:26:35 UTC 2016

Hi, Andy.
I suggest to check the latest jdk9 and jdk8. Do you able to reproduce 
this bug on jdk8u112?

On 19.09.16 17:19, Andy Lee wrote:
> Not sure if this is the best place to ask, but I'm looking for good way
> to prevent the JFrame/JDialog memory leaks caused
> by https://bugs.openjdk.java.net/browse/JDK-8029147
> The best solution I've found so far is to use reflection to dig in and
> null out the 'target' fields on the LWComponentPeer and CPlatformWindow
> after disposing.  This at least allows the JDialog/JFrame instance to be
> GC'd (along with any heavier objects they may reference), but isn't
> optimal since ultimately the LWComponentPeer and CPlatformWindow
> instances still end up leaking.  Another problem with this approach is
> that we have hundreds of uses of JFrames/JDialogs across our codebase
> and this workaround would require each one of them to be modified to add
> this special cleanup logic; I'd like to avoid that if at all possible~
> Any suggestions?
> ~Andy Lee

Best regards, Sergey.

More information about the awt-dev mailing list