cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why is "Force Garbage Collection before creating snapshot" required for .NET?

dave_mauney
Dynatrace Champion
Dynatrace Champion

I am working with a customer where we suspect there may be many small objects created but our analysis is hampered because the "Force Garbage Collection before creating snapshot" flag is turned on and grayed out for .NET and has "(Required for .NET)" beside it even.

Why is it required to force garbage collection? Is it a limitation of the CLR?

Thanks,

dave

1 REPLY 1

dave_mauney
Dynatrace Champion
Dynatrace Champion

Here is a synopsis of the answer from the lab I got on the internal case I opened for this question:

Our agent uses the official profiler API of the .NET CLR, which allows getting objects on the heap only from the GC with some callbacks during a GC run.


These callbacks are also the reason for the slow down of the CLR when the dump feature is enabled.

However, CLRs shipped with v4.5 and higher of the framework no longer have this problem when the "automatic" mode is selected, since we will enable this at runtime only for the time of taking the dump.

If you want to see the objects before a GC run, a full memory dump of that process needs to be taken and cumbersome manual WinDbg analysis needs to be done (which requires symbols of the used libraries).

I'm not aware of possibly existing 3rd party tools that could take over the manual part and visualize the heap or create statistics.

Thanks,

dave