On Tue, 22 Aug 2023 09:54:11 GMT, Prasanta Sadhukhan <psadhuk...@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.

I should note, there is a memory leak still when using `Disposer`.  Each time 
content is switched, but the `SwingNode` is re-used, a `DisposerRecord` is 
created that only gets cleaned up when `SwingNode` goes out of scope.  In other 
words, a million content changes will leave behind a million `DisposerRecord`s. 
 

So, either there needs to be a `removeRecord` added to `Disposer`, or you could 
switch to the `TreeShowingProperty` solution.

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

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

Reply via email to