Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8227619: Potential memory leak in javafx.scene.control.ListView #84

Closed
wants to merge 1 commit into from

Conversation

arapte
Copy link
Member

@arapte arapte commented Jan 10, 2020

ListView does not get GCed because SelectedItemsReadOnlyObservableList adds a ListChangeListener to the (ObservableList) items of ListView.

Adding a WeakListChangeListener instead of ListChangeListener fixes the issue.

Added a unit test and verified that existing tests do not fail due to this change.

Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

JDK-8227619: Potential memory leak in javafx.scene.control.ListView

Approvers

  • Kevin Rushforth (kcr - Reviewer)
  • Ajit Ghaisas (aghaisas - Reviewer)

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 10, 2020

👋 Welcome back arapte! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request (refresh this page to view it).

@openjdk openjdk bot added the rfr Ready for review label Jan 10, 2020
@mlbridge
Copy link

mlbridge bot commented Jan 10, 2020

Webrevs

@kevinrushforth
Copy link
Member

/reviewers 2

@openjdk
Copy link

openjdk bot commented Jan 24, 2020

@kevinrushforth
The number of required reviews for this PR is now set to 2 (with at least 1 of role reviewers).

@kevinrushforth
Copy link
Member

Presuming that using a weak reference causes no other issues, the fix looks fine and will resolve the leak. How confident are you that there are no cases where the listener might be prematurely garbage collected?

@arapte
Copy link
Member Author

arapte commented Feb 7, 2020

How confident are you that there are no cases where the listener might be prematurely garbage collected?

The listener is added by ListViewBitSetSelectionModel. The selection model is set only once for a ListView and we do not unset it. So the change looks very safe to me.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, this makes sense. Somewhat related to this, I see that ListViewBitSetSelectionModel is using a WeakInvalidationListener in order to avoid a similar problem.

@openjdk
Copy link

openjdk bot commented Feb 11, 2020

@arapte This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type /integrate in a new comment to proceed. After integration, the commit message will be:

8227619: Potential memory leak in javafx.scene.control.ListView

Reviewed-by: kcr, aghaisas
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /solves command.

Since the source branch of this PR was last updated there have been 46 commits pushed to the master branch. Since there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge master into your branch, and then specify the current head hash when integrating, like this: /integrate a74137a1191605f878a25e5f2717b0358fd9368a.

➡️ To integrate this PR with the above commit message, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Feb 11, 2020
@arapte
Copy link
Member Author

arapte commented Feb 11, 2020

/integrate

@openjdk openjdk bot closed this Feb 11, 2020
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Ready to be integrated labels Feb 11, 2020
@openjdk
Copy link

openjdk bot commented Feb 11, 2020

@arapte The following commits have been pushed to master since your change was applied:

  • a74137a: 8236839: System menubar removed when other menubars are created or modified
  • 21d3b7e: 8237453: [TabPane] Incorrect arrow key traversal through tabs after reordering
  • e224e54: 8238526: Cherry pick GTK WebKit 2.26.3 changes
  • 6968e38: 8237469: Inherited styles don't update when node is moved
  • 3c55a7e: Merge
  • a4b9f24: 8237503: Update copyright header for files modified in 2020
  • 1749e85: 8237975: Non-embedded Animations do not play backwards after being paused
  • 2ab40c1: 8231513: JavaFX cause Keystroke Receiving prompt on MacOS 10.15 (Catalina)
  • aa91ebb: 8237944: webview native cl "-m32" unknown option for windows 32-bit build
  • 56267e1: 8237770: Error creating fragment phong shader on iOS
  • 95bf2c0: 8237782: Only read advances up to the minimum of the numHorMetrics or the available font data.
  • d05e8fc: 8237833: Check glyph size before adding to glyph texture cache
  • 1213ea7: Merge
  • 1823f6e: 8088198: Exception thrown from snapshot if dimensions are larger than max texture size
  • ca37c1f: 8238249: GetPrimitiveArrayCritical passed with hardcoded FALSE value
  • b96bc52: 8237003: Remove hardcoded WebAnimationsCSSIntegrationEnabled flag in DumpRenderTree
  • d303a21: Merge
  • 5a0e71b: 8237372: NullPointerException in TabPaneSkin.stopDrag
  • 79fc0d0: 8232824: Removing TabPane with strong referenced content causes memory leak from weak one
  • aa6f3a4: 8236912: NullPointerException when clicking in WebView with Button 4 or Button 5
  • 921389f: Merge
  • da99e24: 8237823: Mark TextTest.testTabSize as unstable
  • 66ac99f: Merge
  • 9ae37f1: 8236753: Animations do not play backwards after being stopped
  • b2d8564: 8233942: Update to 609.1 version of WebKit
  • f5ee963: 8157224: isNPOTSupported check is too strict
  • be22e85: 8237078: [macOS] Media build broken on XCode 11
  • 20325e1: Merge
  • 16cea41: Merge
  • 63520a0: Merge
  • 8a5344c: Merge
  • 2e0d01c: Merge
  • a96704e: Merge
  • 71fa9af: Merge
  • a3711e2: Merge
  • 2d5d7e0: Merge
  • 962bdd1: 8232214: Improved internal validations
  • 2d2b824: 8232128: Better formatting for numbers
  • 81f7738: 8232121: Better numbering system
  • 8e55294: Merge
  • 1325f11: Merge
  • f759dd9: Merge
  • fed185a: Merge
  • 592d745: Merge
  • a0b4b14: 8227473: Improve gstreamer media support
  • a557dd9: 8236733: Change JavaFX release version to 15

Your commit was automatically rebased without conflicts.

Pushed as commit e986459.

@openjdk openjdk bot removed the rfr Ready for review label Feb 11, 2020
@mlbridge
Copy link

mlbridge bot commented Feb 11, 2020

Mailing list message from Ambarish Rapte on openjfx-dev:

Changeset: e986459
Author: Ambarish Rapte <arapte at openjdk.org>
Date: 2020-02-11 10:17:09 +0000
URL: https://git.openjdk.java.net/jfx/commit/e9864593

8227619: Potential memory leak in javafx.scene.control.ListView

Reviewed-by: kcr, aghaisas

! modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/SelectedItemsReadOnlyObservableList.java
! modules/javafx.controls/src/test/java/test/javafx/scene/control/ListViewTest.java

@arapte arapte deleted the ListviewLeak branch April 28, 2020 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants