Skip to content

Issue #627 Extreme memory usage with large blocks of text#779

Merged
Jugen merged 1 commit intoFXMisc:masterfrom
JonathanMarchand:bugfix/issue-627-memory-leak-in-paragraphtext
Nov 4, 2018
Merged

Issue #627 Extreme memory usage with large blocks of text#779
Jugen merged 1 commit intoFXMisc:masterfrom
JonathanMarchand:bugfix/issue-627-memory-leak-in-paragraphtext

Conversation

@JonathanMarchand
Copy link
Copy Markdown
Contributor

Resolves #627

Fix memory leak of ParagraphText through listeners:

  • Make listeners static class
  • Use WeakReference to refer to the ParagraphText from the listeners
  • Remove the listeners if the ParagraphText is garbage collected.

Fix memory leak of ParagraphText through listeners:
- Make listeners static class
- Use WeakReference to refer to the ParagraphText from the listeners
- Remove the listeners if the ParagraphText is garbage collected.
@Jugen Jugen merged commit 048c290 into FXMisc:master Nov 4, 2018
@Jugen
Copy link
Copy Markdown
Collaborator

Jugen commented Nov 5, 2018

Thanks for this @JonathanMarchand

JFormDesigner pushed a commit to JFormDesigner/RichTextFX that referenced this pull request Dec 15, 2018
…ret on dispose instead of waiting for GC (this improves PR FXMisc#779, issue FXMisc#627)

without this change, disposed ParagraphText objects still listen to selection and caret and do some useless stuff
Jugen pushed a commit that referenced this pull request Dec 16, 2018
…s on disposal (#791)

* ParagraphText: immediately remove listeners from SelectionPath and Caret on dispose instead of waiting for GC (this improves PR #779, issue #627)

* ParagraphText: since weak listeners are no longer required for selection and caret listeners, remove listener classes again and move listener code to constructor (saves 100 lines of code)

* ParagraphText: MapChangeListener.Change.wasAdded() and wasRemoved() may both return true when replacing an item. So check both and handle wasRemoved() before wasAdded().

* Fixed (rare) NPE in class ParagraphText when GC frees object between two WeakReference.get() invocations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants