[Rev 01] RFR: 8232824: Removing TabPane with strong referenced content causes memory leak from weak one

Ambarish Rapte arapte at openjdk.java.net
Wed Jan 22 17:55:05 UTC 2020


> This PR is a fix for [JDK-8232824](https://bugs.openjdk.java.net/browse/JDK-8232824)
> This issue is regression of [JDK-8187074](https://bugs.openjdk.java.net/browse/JDK-8187074).
> 
> Issue.
> - `Parent.viewOrderChildren` is a list of children sorted according to view order.
> - `Parent.viewOrderChildren` is cleared and computed in `Parent.computeViewOrderChildren()` which is called from `Parent.doUpdatePeer()` when a `pulse `is received.
> 
> - Below is the scenario mentioned in this issue,
> 1. `TabPane` is created with few `tabs`.
> 2. For each tab,  a `TabHeaderSkin` is created with `setViewOrder(1)` and is added to `TabHeaderArea.headersRegion`
> 3. All these `TabHeaderSkin`s are added to `Parent.viewOrderChildren` on `pulse`.
> 4. When the `TabPane` is removed from scene, then on the next pulse the method `Parent.doUpdatePeer()` does not get called for `TabHeaderArea.headersRegion`, because it is not part for scenegraph anymore.
> So `Parent.computeViewOrderChildren()` does not get called and the `Parent.viewOrderChildren` does not get cleared, which causes the leak.
> 
> Fix:
> Clear the `Parent.viewOrderChildren` list when marking `DirtyBits.PARENT_CHILDREN_VIEW_ORDER` as dirty.
> `Parent.viewOrderChildren` will be computed on next `pulse`.
> This will maintain lazy computation of `Parent.viewOrderChildren`. 
> 
> Added a system test, fails without fix and passes with. No failures in existing tests.

The pull request has been updated with 1 additional commit.

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

Added commits:
 - d64f6c86: Adding system test using Group and Shape

Changes:
  - all: https://git.openjdk.java.net/jfx/pull/79/files
  - new: https://git.openjdk.java.net/jfx/pull/79/files/cbcc3161..d64f6c86

Webrevs:
 - full: https://webrevs.openjdk.java.net/jfx/79/webrev.01
 - incr: https://webrevs.openjdk.java.net/jfx/79/webrev.00-01

  Stats: 117 lines in 1 file changed: 117 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jfx/pull/79.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/79/head:pull/79

PR: https://git.openjdk.java.net/jfx/pull/79


More information about the openjfx-dev mailing list