当 .NET 垃圾收集压缩堆时,“分配字节”会被压缩。性能计数器更新了吗?
.NET CLR 的垃圾收集器会压缩堆。我认为这意味着当它扫描以删除未标记的对象时,堆上的下一个(仍然存在的)对象会向上移动。因此,根据我的理解,压缩会移动物体。移动这些对象时,移动是否会影响分配的字节/秒性能计数器?或者这个计数器只是添加到堆上的字节数?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据关于 GC 性能计数器的这篇文章, “分配的字节/秒”计数器计算 Gen0 和 LOH 中对象的分配字节数。由于 Gen0 在每次 Gen0 GC 后总是被清空,并且 LOH 永远不会进行碎片整理,因此它不应影响此指标。
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.