Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
How to read the memory snapshot in Visual Studio

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.

  1. 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.

  2. 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?

enter image description here

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

  1. 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.

  2. 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:

  • https://devblogs.microsoft.com/devops/using-visual-studio-2013-to-diagnose-net-memory-issues-in-production/
  • https://docs.microsoft.com/visualstudio/profiling/analyze-memory-usage
  • https://docs.microsoft.com/visualstudio/profiling/memory-usage
over 4 years ago · Santiago Trujillo Report

0

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/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!