.NET 4.0 Induced GC Source Tracking

I use PerfMonitor.exe ( http://bcl.codeplex.com/wikipage?title=PerfMonitor ) to track some .NET performance issues in a .NET 4.0 application that uses some third-party libraries, some of which are internal code.

When I run the Perfmonitor GCTime report, it lists a single GC and classifies them in several ways. One column in the report is called Reason. Some GCs have Reason = "Induced", while others have Reason = "SmallAlloc".

I assume that GCs labeled “SmallAlloc” are caused by regular distribution (New Object ()), and GCs labeled “Induced” are called by a call to “System.GC.Collect”. Please let me know if you think I made the wrong assumption.

I am trying to find the code that calls System.GC.Collect, but I have not been successful. Using MSVS 2010 Professional, I set a breakpoint in System.GC.Collect and made sure that this breakpoint works by writing a simple test function that contains a call to System.GC.Collect. However, my application that I configure does not break at this breakpoint, which makes me think that none of the codes are calling System.GC.Collect.

I think maybe there is a native code that induces GC by calling its own function in mscorwks.dll directly and bypassing System.GC.Collect. I see that System.GC.Collect calls _Collect in JitHelpers.cpp, which is located in mscorwks. Is there a way to set a breakpoint in this function?

+3
source share
2 answers

I looked a little closer to the output of PerfMonitor.exe. I'm not sure that every GC marked as "Induced" is actually called System.GC.Collect. It appears that all Gen 1 GCs are labeled Reason = "Induced" and all Gen 0 GCs are labeled Reason = "SmallAlloc". Gen2 GCs are designated Reason = "LowMemory".

.NET Induced GCs. , GC. , Perfmonitor.exe .

0

, , GC.Collect() , GC.Collect , GC, GCs.

System.GC.Collect . , Framework, . , , / - . . , , " " "- > - > ".

0

All Articles