Visual Studio 2017 Community Edition
I am trying to understand/use the Performance Profiler's Memory Usage in what I feel must be a memory leak in my application (MVVM with custom controls). Three snapshots were taken:
I then compared snapshot #3 to snapshot #1. In the resulting table, I imposed a filter of "NewProgressNoteView". The below is the results of expanding the instance of the top Doctor_Desk.Views.NewProgressNoteView. Of note is '[Cycle Detected]' which feels suspicious, but I do not know what it means exactly or how to use this information to fix the memory leak(s)? What do I do next?
Any help would be most appreciated.
TIA.
A memory leak starts when a program requests a chunk of memory from the operating system for itself and its data. As a program operates, it sometimes needs more memory and makes an additional request.
As per Apple, a memory leak is:Memory that was allocated at some point, but was never released and is no longer referenced by your app. Since there are no references to it, there's now no way to release it and the memory can't be used again.
Memory leaks are when programs on the computer incorrectly manage memory allocations. This is not uncommon on modern software and can cause performance drags on the system. The easiest way to fix this issue is to close and reopen the program with the leak, as it will reset the allocations.
What Is [Cycle Detected] when viewing managed memory?
When viewing Heap snapshots inside Visual Studios Diagnostic tools you have:
The Object Type Window which shows objects held in memory.
When you select a particular Object Type, you can access:
Both these tabs are reference views which help you trace an objects parent and child references presented via an expanding-tree menu.
Cycle Detected simply means that the memory analyzer has found the parent or child reference directly or indirectly references back to your selected object. So rather than display a circular tree-view trace it adds a cycle detected tag.
This isn't neccessarily a bad thing or your root issue.
For further reading about analyzing memory and an expanded explanation of reference views check out this msdn article: https://docs.microsoft.com/en-us/visualstudio/profiling/analyze-memory-usage?view=vs-2019
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With