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

Prasanta Sadhukhan psadhukhan at openjdk.org
Tue Aug 22 10:02:45 UTC 2023


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.

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

Commit messages:
 - 8262518: SwingNode.setContent does not close previous content, resulting in memory leak
 - 8262518: SwingNode.setContent does not close previous content, resulting in memory leak

Changes: https://git.openjdk.org/jfx/pull/1219/files
 Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1219&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8262518
  Stats: 14 lines in 2 files changed: 5 ins; 1 del; 8 mod
  Patch: https://git.openjdk.org/jfx/pull/1219.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1219/head:pull/1219

PR: https://git.openjdk.org/jfx/pull/1219


More information about the openjfx-dev mailing list