Garbage Collection in Memory Profiler ?

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
Posts: 2
Joined: Tue Jun 05, 2018 5:51 am

Garbage Collection in Memory Profiler ?

Post by abhishabhishek » Tue Jun 05, 2018 1:45 pm

Hi ,

Does Memory Profiler execute full garbage collection when we take snapshot in it ?

Abhishek Sharma

Andreas Suurkuusk
Posts: 1000
Joined: Wed Mar 02, 2005 7:53 pm

Re: Garbage Collection in Memory Profiler ?

Post by Andreas Suurkuusk » Tue Jun 05, 2018 2:16 pm

Yes, when you collect a snapshot, the profiler forces the .NET runtime to cleanup as much memory as possible (by performing multiple garbage collections, allowing finalizers to run, and trigger WPF cleanup when profiling a WPF application). This avoids presenting instances that are eligible for garbage collection.

If you wish to see information about unreachable instances or instances in the finalization queue, you can collect the snapshot using the "Collect gen #0 snapshot" command, or by collecting a peak snapshot. A gen #0 snapshot will not perform any heap cleanup, and will include information about unreachable instances. A peak snapshot also includes information about instances collected by the garbage collector.
Best regards,

Andreas Suurkuusk
SciTech Software AB

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests