Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When the .NET Garbage Collection compacts the heap is the "Allocate Bytes" performance counter updated?

The .NET CLR's Garbage Collector compacts the heap. I take this to mean that as it sweeps through to remove unmarked objects, the next (still live) object on the heap gets moved up. Hence, from my understanding, compacting moves objects. When those objects are moved, does the move impact the Allocated Bytes/Sec performance counter? Or is this counter simply how many bytes added onto the heap?

like image 405
LJM Avatar asked Nov 14 '22 22:11

LJM


1 Answers

According to this article on GC perf counters, the "Allocated bytes/s" counter is accounting for the number of allocated bytes for objects in Gen0 and LOH. Since the Gen0 is always emptied after each Gen0 GC and LOH is never subject to defragmentation, it should not affect this metric.

like image 197
PHeiberg Avatar answered Dec 09 '22 18:12

PHeiberg