TreeNode memory leak and multiple getChildren calls
See original GitHub issueSteps to reproduce
This issue can be reproduced with release 7.0.1 of this GitHub repository.
- Run
npm run example:cli:win
- In Chrome, open http://localhost:4200
- Open the browser console.
- Expand “asyncroot”. Observe that the console shows one “toggleExpanded” event and one “loadNodeChildren” event, which is expected.
- (Important) Refresh the browser to clear the asynchronously loaded children.
- Click the “Add Node” button ten times.
- (Optional) Use the browser developer tools to try to force garbage collection.
- Expand “asyncroot”. Observe that the console shows one “toggleExpanded” event and eleven “loadNodeChildren” event.
Observations
- Every time
TreeModel.update()
is called a newTreeNode
object is created for every node in the tree. TheTreeNode
objects never seem to be destroyed, resulting in a significant memory leak. - On expanding a node that loads children asynchronously, all the
TreeNode
objects that have ever been created for that node will callgetChildren
. IfgetChildren
makes a HTTP request this will result in multiple identical requests being issued in rapid succession.
This makes the component virtually unusable in any scenario that involves updating a tree with lazy loading.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
TreeNode memory leak and multiple getChildren calls #582
On expanding a node that loads children asynchronously, all the TreeNode objects that have ever been created for that node will call getChildren...
Read more >[JDK-8125065] Memory Leak issue in TreeView
I get Memory Leaks in the TreeView, if I open the stage which contains the TreeView ... getChildren().clear(); ... The same is true,...
Read more >Tree View JavaFX Memory out of Space - Stack Overflow
Whenever I expand or collapse Item in tree ,twice or thrice I get JAVA HEAP MEMORY OUT OF SPACE and whole UI hangs...
Read more >Memory Leak Issue with inline DataTemplates in Xaml - MSDN
I have been trying to track down why some of the views in my Silverlight MVVM app are not being garbage collected and...
Read more >refactor(treeview): mr items can be now disposed (!156) - GitLab
This MR introduced a cascade of dispose() calls that starts when we call DataProvider.getChildren() (every time we refresh the Tree View). How ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Great work with memory leak fixes. It’s possible to release new version from this updated master?
Published in 8.0.1.
Thanks for the PR!