Memory leak in master branch (automation related?)
See original GitHub issueDescribe the bug The latest master branch (tested 0.10.999-cibuild0020870-beta https://github.com/AvaloniaUI/Avalonia/commit/cea6bc27a06f25b4f2d3a73d3411e904b1767e74) has a memory leak, probably related to Automation code.
Note: this is a regression from the current stable 0.10.x version (which doesn’t have automation related modules).
To Reproduce The repro is very simple - just add a button, press it and the button will not be freed anymore.
- Clone the repo: https://github.com/BAndysc/AvaloniaMenuLeak
- Checkout branch
leak2 - Run the app
- The top text shows managed used memory, in the beginning it is less than 3 MBs
- Press the button Add control
- This will spawn a control, that has a reference to 1GB byte array, so obviously the ram usage will rise up to 1 GB
- Press Remove Control
- GC will free the control and datacontext almost instantly, and it will go down to 3 MBs, so far so good.
- Press Add control again
- This time click the button ‘Click me’
- Press Remove control
- Notice this time the memory usage doesn’t drop. The control is not freed!
Screenshots
dotMemory screenshot:

Desktop:
- OS: Mac
- Version: 0.10.999-cibuild0020870-beta (it works fine on 0.10.14)
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
[BUG] Memory leak in master ProcessManager #60049
We updated our infrastructure from 3002.6 to 3003 and observed a rather severe memory leak in the ProcessManager of the salt master.
Read more >Best Practices For Automation Tester to Avoid Java ...
A memory leak is a type of issue that will not cause any problem unless Java Heap Memory is overflown, but once you...
Read more >Finding Memory Leaks in Mobile Apps (Part 2: Automation)
First and foremost, we needed to build automated flows to constantly monitor and prevent new memory leaks and eliminate the existing ones as ......
Read more >Memory leak when using UI Automation in Windows 10
I'm experiencing a memory leak on Windows 10 machine and after investigation of some dump taken from the process causing the issue (a...
Read more >TFS Build - MSBuild 14 x64 memory leak or too high ...
Looks like it's a known bug which was fixed in the master branch of the MSBuild on the github.
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 Free
Top 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

Yeah, reproduced using Accessibility Insights to trigger automation. Got three weak references that live after button was detached:
if you mean my sample code, then the previous one (menu related) didn’t have this button, I’ve discovered it accidentally, while trying to reproduce another leak