c# - (Nearly) all garbage collections are full collections -
i have been collecting performance counters managed application on 4 days. during time, there have been following garbage collections:
- generation 0: 133,695
- generation 1: 133,413
- generation 2: 133,254
some of these "induced" full collections using gc.collect()
. there 323 on 4 days.
why (or, all) collections full collections? guessing circumstance contributing high "% time in gc" counter (upwards of 70%, when allocated bytes/sec drops significantly).
it may or may not important note i'm running .net 4.0, 64-bit, , using server gc, per configuration file.
i'm allocating large amounts of memory (upwards of 300 mb/sec @ times)
that's enough explain observe. trigger lots of collections during second, gen #0 , gen #1 heaps not large. high likelihood objects in these generations still in use, since allocated, gen #0 , 1 collections don't make enough space , every object gets promoted gen #2. gc has countermeasure this, automatically grow generation sizes. can't keep ravenous hunger memory have. can use .net memory performance counters in perfmon.exe observe this. .net memory profiler give insight prettier graphs.
allocating memory @ such high rate isn't easy, must allocating lots of arrays. in explain it, arrays larger 85,000 bytes allocated in large object heap. ways reuse arrays. .net collection classes use arrays under hood.
Comments
Post a Comment