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:
- Paths to Root – Don’t be fooled by the fact this information is presented in a tree-view which usually denotes children. Paths to root actually shows Parent objects that reference the object you selected.
- Referenced Types – Shows the child types referenced by the selected object.
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://learn.microsoft.com/en-us/visualstudio/profiling/analyze-memory-usage?view=vs-2019