RFR: 8262518: SwingNode.setContent does not close previous content, resulting in memory leak

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Aug 23 03:30:50 UTC 2023


On Tue, 22 Aug 2023 09:54:11 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> Issue is when setting the content of a SwingNode, the old content is not garbage collected owing to the fact
> JLightweightFrame is never being released by SwingNodeDisposer
> 
> The SwingNodeDisposer holds an hard pointer to the JLightweightFrame that prevents its collection
> 
> Modified `SwingNode.setContentImpl`  function to use a WeakReference to properly release the memory.

As suggested, optimized without WeakReference

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1219#issuecomment-1689213243


More information about the openjfx-dev mailing list