RFR: 8259046: ViewPainter.ROOT_PATHS holds reference to Scene causing memory leak

Ambarish Rapte arapte at openjdk.java.net
Mon Feb 8 17:07:45 UTC 2021


On Wed, 27 Jan 2021 13:31:45 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

> 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.

Looks good to me.

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

Marked as reviewed by arapte (Reviewer).

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


More information about the openjfx-dev mailing list