[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-openjfx-dev
Subject:    RFR: 8259046: ViewPainter.ROOT_PATHS holds reference to Scene causing memory leak
From:       Kevin Rushforth <kcr () openjdk ! java ! net>
Date:       2021-01-27 13:35:49
Message-ID: DPJb4LF7gO_IO5elr8ZzvPzawFrdq6w4R7IuBr4MsLQ=.d20b5dc9-4af4-4182-95d1-9aa63ce4e1a9 () github ! com
[Download RAW message or body]

Prism implements a dirty region optimization, where in many cases, only part of the \
scene graph is re-rendered when something changes. In support of this, the \
`ViewPainter` class in the Quantum Toolkit keeps an array of node paths, \
`ROOT_PATHS`, which is a list of sub-trees in the scene graph that need to be \
rendered based on a change to that node. The entries in the `ROOT_PATHS` array are \
intended to be transient during the rendering of a single pass of a single scene. \
They are recreated every time a scene is rendered. The leak occurs because the \
entries are not cleared after being used. The fix is to clear each entry after it is \
rendered. In addition to static analysis, which shows that the entries are never used \
again after a frame is rendered, I have done a full build and test, including manual \
tests, to be sure that there is no regression.

I have added a test that will fail consistently on Mac and Windows (and \
intermittently on Linux) without the fix. It passes consistently on all platforms \
with the fix.

Even though this is a simple change, it is in an area that has historically been \
fragile, so I would like two reviewers.

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

Commit messages:
 - 8259046: ViewPainter.ROOT_PATHS holds reference to Scene causing memory leak

Changes: https://git.openjdk.java.net/jfx/pull/388/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jfx&pr=388&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8259046
  Stats: 116 lines in 2 files changed: 116 ins; 0 del; 0 mod
  Patch: https://git.openjdk.java.net/jfx/pull/388.diff
  Fetch: git fetch https://git.openjdk.java.net/jfx pull/388/head:pull/388

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic