Forcing Garbage Collection automatically

Questions about YourKit .NET Profiler
Post Reply
edrishn
Posts: 4
Joined: Thu Feb 07, 2013 6:42 am

Forcing Garbage Collection automatically

Post by edrishn »

Hi and thanks for YourKit,

I'm using Profiler API (CaptureSnapshot) in some automated UI tests for finding memory leaks. It seems garbage collection was not forced in API. When I tested same scenario through Profiler UI and 'Force Garbage Collection' everything is OK.

I had no luck in calling GC.Collect and GC.WaitForPendingFinalizers and ...

Thanks in advance
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Forcing Garbage Collection automatically

Post by Anton Katilin »

Hi edrishn

We've added a new method Controller.ForceGC() for this purpose in the latest build 14518:

http://www.yourkit.com/dotnet/download/

http://www.yourkit.com/docs/dotnet/api/Index.html

It does the same as the profiler UI action.

Best regards,
Anton
Post Reply