question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TreeNode memory leak and multiple getChildren calls

See original GitHub issue

Steps to reproduce

This issue can be reproduced with release 7.0.1 of this GitHub repository.

  1. Run npm run example:cli:win
  2. In Chrome, open http://localhost:4200
  3. Open the browser console.
  4. Expand “asyncroot”. Observe that the console shows one “toggleExpanded” event and one “loadNodeChildren” event, which is expected.
  5. (Important) Refresh the browser to clear the asynchronously loaded children.
  6. Click the “Add Node” button ten times.
  7. (Optional) Use the browser developer tools to try to force garbage collection.
  8. Expand “asyncroot”. Observe that the console shows one “toggleExpanded” event and eleven “loadNodeChildren” event.

Observations

  1. Every time TreeModel.update() is called a new TreeNode object is created for every node in the tree. The TreeNode objects never seem to be destroyed, resulting in a significant memory leak.
  2. On expanding a node that loads children asynchronously, all the TreeNode objects that have ever been created for that node will call getChildren. If getChildren 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:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kareljurickacommented, Nov 26, 2018

Great work with memory leak fixes. It’s possible to release new version from this updated master?

0reactions
adamkleingitcommented, Dec 1, 2018

Published in 8.0.1.

Thanks for the PR!

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found