I use Visual Studio to take memory snapshot of my application.
I have some questions about understanding the data I got. I after I capture the memory snapshot, I filter out one of my class, say MyClassPanel. I only use MyClassPanel in my xmal files.
why ‘Paths to Root’ for MyClassPanel are all ‘MyClassPanel [RefCount Handle, Count:1]’? (i.e. same name but with a string [RefCount Handle at the end] and a different Count value) what does this mean? In other class, I filter, I see the 'Paths to Root' are different class names.
I have 24 MyClassPanel (from the count in top table). And in the ‘Reference Count’ column in the bottom table, when I add them up, they are 24.
Is that always the case? I think ‘Count’ and ‘Reference Count’ means different things. In this case, they add up. Does this make sense?
To find memory leaks and inefficient memory usage, you can use tools such as the debugger-integrated Memory Usage diagnostic tool or tools in the Performance Profiler such as the . NET Object Allocation tool and the post-mortem Memory Usage tool.
Check Computer Memory Usage EasilyTo open up Resource Monitor, press Windows Key + R and type resmon into the search box. Resource Monitor will tell you exactly how much RAM is being used, what is using it, and allow you to sort the list of apps using it by several different categories.
Take a memory snapshotFrom the main menu, select View | Tool Windows | Profiler, right-click a running process and select Capture Memory Snapshot. When the snapshot is captured, it opens for analysis right away.
The Paths to Root view shows the references to this type keeping it from being garbage collected. Since your class is a Xaml page, the reference which keeps the class alive is a CLR handler for the Xaml page. These show up as RefCount Handle.
Count and reference count are indeed not the same. Count is the number of instances, reference count the number of references. Because each instance in your case only has one reference, it makes sense they add up.
For more info:
I am not a big fan of Visual Studio Snapshot analyzer. There are quite a few complications available if finalization is not properly executed before taking the snapshot. I am not sure how Visual Studio handles that. However, the snapshot you have provided doesn't make much sense for me either.
I would suggest you to download the ANTS memory profiler and investigate this. It comes with a reasonable trial period. By using that, you will be able to see all references to each instance by using it's 'Retention Graph'. It will specifically show you which instances keeps the reference to your objects and also it will show you which objects have implemented Dispose but hasn't call. I guess, it will provide more support to find the root cause for this issue.
Have a look at below pages walkthrough
http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/walkthrough http://www.red-gate.com/products/dotnet-development/ants-memory-profiler/
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