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

Memory leak when adding and removing nodes #126

Open
vcbnm opened this issue Jan 6, 2023 · 2 comments
Open

Memory leak when adding and removing nodes #126

vcbnm opened this issue Jan 6, 2023 · 2 comments

Comments

@vcbnm
Copy link

vcbnm commented Jan 6, 2023

In the CodeGenApp, it appears that some memory is not being released when removing nodes. I added several 'For Loop' nodes without connecting them, then selected and deleted them again. Doing this caused the total memory usage of the application to grow.

To test, I've replaced the AutoLayout to add 100 For Loop nodes, then deleted them again manually by selecting them all.
This would increase the memory usage of the application by 400Mb, while deleting them would only free about 56 Mb. GC would not release the memory further down the line. The same issue occurs when adding the nodes manually.
The same seems to occur in the ShaderEditorApp, where adding 100 color nodes would increase memory by 110 Mb, freeing only 11 Mb after removing them.

I've tried the following to further isolate the issue:

  • Created an empty viewmodel that creates a CodeGenNodeView and temporary removing the background color binding.
  • In MainWindow I've removed all subscribers and initialized the instance through new, but kept the reactivecommand to add nodes.
  • Removing all code from the constructor of NetworkViewModel except the initialization of SelectedNodes and DeleteSelectedNodes.

The following I've tried in my own project:

  • Update ReactiveUI to 18.0.4. It appeared a known memory leak involved nested ViewModelViewHosts ([BUG] MemoryLeak on WPF reactiveui/ReactiveUI#3091). I've not tried later versions due to a change in DynamicData which prevented it from compiling.
  • I've added disposers to manually dispose subscribers when removing nodes, to see if everything was working as intended. Disposables for viewmodels to dispose subscribers are called. Disposers on view are also called (when using WhenActivated).
@1234567hp
Copy link

Is it settled now? I have the same problem

@orosbogdan
Copy link

Same here

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

No branches or pull requests

3 participants