Gen #2 instances question

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.

Moderator: SciTech Software

Gen #2 instances question

Postby DanS » Mon Aug 14, 2017 1:07 pm

I looked over the documentation, but could not find an answer to my question. Does the number of Gen #2 instances reflect the number of objects ready for GC which survived Gen #0 and Gen #1? The reason I ask is that I’m seeing a lot of memory listed as Gen #2, and our application is having OOM issues. I’m wondering if there is a blocked finalizer not allowing for the Gen #2 memory to be cleaned up. Here is a screen shot of the profiler.
Thanks
Dan

MP_SShot.jpg
Screen Shot
DanS
 
Posts: 2
Joined: Mon Aug 14, 2017 12:44 pm

Re: Gen #2 instances question

Postby Andreas Suurkuusk » Tue Aug 15, 2017 11:48 am

The number of gen #2 instances reflects the number of instances that have survived a gen #0 and gen #1 collection, but are still reachable from a root. So they are not eligible for garbage collection. Note that when you collect a full snapshot in the profiler, the profiler performs several full GCs in order to only present actual live instances. If you want to get information about unreachable instances, you can use the "Collect gen#0 snapshot" command instead (or attach to the process using "Inspection only attach"). This will prevent a full garbage collection from being performed and there will still exist unreachable instances in the heap (see screenshot).

Unreachable.png


Whether there are instances that are waiting to be finalized, or if there is a blocked finalizer, is not possible to determine from the screenshot. You can get more information about how the instances are kept alive by investigating the root paths of the instances (e.g. by investigating the Type details). If possible, I recommend that you run the profiled process under the profiler (e.g. by using "Profile application"). This way you will get much more detailed information, for instance information about potentially blocked finalizers.
Best regards,

Andreas Suurkuusk
SciTech Software AB
Andreas Suurkuusk
 
Posts: 964
Joined: Wed Mar 02, 2005 7:53 pm
Location: Sweden

Re: Gen #2 instances question

Postby DanS » Tue Aug 15, 2017 1:26 pm

Thank you. I'm still learning about Garbage Collection and your tool.
DanS
 
Posts: 2
Joined: Mon Aug 14, 2017 12:44 pm


Return to Using .NET Memory Profiler

Who is online

Users browsing this forum: No registered users and 5 guests

SciTech Software logo

© Copyright 2001-2016. SciTech Software AB
All rights reserved.


SciTech Software AB
Kartvägen 21
SE-175 46 Järfälla
Sweden


E-mail: mail@scitech.se

Telephone: +46-706868081

cron