Excessive collection of generals 2

I had a problem in my application where I see an excessive amount of Gen 2 garbage collections. From what I read, it seems like a good ratio of Gen1: Gen1: Gen2 collections should be 100: 10: 1. I am very close to 1: 1: 1. Each collection seems to have a Gen2 collection. I tried to find out the reason for this, but I was not lucky. Things I tried:

  • Used by the .NET Memory Profiler to find out which objects are being created. I had a Perfmon open showing me the heap size of Gen 2, and I tried to take pictures when it was low and when it was high, and then compared the difference. It was partially successful. Then% Time in GC seems lower, but there are still as many Gen2 collections in Gen1.

  • I turned off the main function in my application and found that this was the cause of this problem. I don’t know how this helps, but I thought that I would say that I have a general idea where there is a problem in my code.

  • I tried other tools too. Red Gate memory profiler. It didn’t help either.

So here are my questions:

  • What makes the CLR build Gen2 on Gen0 or Gen1? I read that it could be LOH, but I confirmed that this is not my problem.

  • What other troubleshooting methods should I use?


Edit: 6/6/2011

System.Diagnostics.PerformanceCounterCategory.GetInstanceNames(). , . , HKEY_PERFORMANCE_DATA "230". "". , 65000 . , 85000, , - LOH. WinDbg "mscorwks! Svr:: gc_heap:: allocate_large_object".


: 6/7/2011

. -, 130 000 , . , Gen2, LOH. , P/Invoke, .

+3
2

, . , .

0

. , GEN2, , - , , , , - .

, ; ( - ).

- . ., .

+1

All Articles