阻止垃圾收集发生在背景垃圾收集之外. [英] Blocking garbage collection occurred outside background garbage collection.

查看:91
本文介绍了阻止垃圾收集发生在背景垃圾收集之外.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大型应用程序,有时会完全停止所有线程.我们正在使用gcServer = enabled和gcConncurrent = enabled,但是我们仍然遭受偶尔的第2代阻塞收集的困扰.我已经找到了 使用Windows性能工具(WPT)并记录CLR和内核事件.当我们拥有第2代集合时,由于类型为0的大对象堆分配而停止运行(GCState_V1Event:原因-

I have a large application that occasionally suffers complete stoppage of all threads. We are using gcServer = enabled and gcConncurrent = enabled, but we are still suffering from occasional Gen 2 blocking collections.  I've traced it down using Windows Performance Tools (WPT) and recording the CLR and Kernel events. The stoppage occurs when we have a Gen 2 collection due to a Large Object heap allocation of type 0 (GCState_V1Event : Reason - Blocking garbage collection occurred outside background garbage collection.).  The application regularly stops for 2-4 seconds on a 16 Core machine with 200 gig of memory during these collections, and  occasionally stops of 15 seconds. The total heap size during the stoppages is about 4-6 gig. During type 1 collections the pause is 100's of msecs, which is acceptable.

有关WPT和EWT(用于Windows的事件跟踪)的文档非常薄.了解"GCState_V1Event:type:

The documentation on WPT and EWT (Event Tracing for Windows) are very thin. Any help understanding "GCState_V1Event:type : 0x0 - Blocking garbage collection occurred outside background garbage collection." is appreciated.

推荐答案

即使是使用并发服务器GC,GC仍必须偶尔阻止和停止线程.  消息的确切含义是-当它必须停止线程进行清理时,它会通知您.

The GC, even with concurrent server GC, still has to occasionally block and stop threads.  The message is exactly that - when it has to stop the threads to cleanup, it notifies you.

LOH可能是罪魁祸首-因此,尝试减少或最小化LOH收集将有所帮助.而且-.NET 4.5在这方面取得了巨大的进步,并且总体而言,对于GC,尤其是新的后台服务器,它具有更好的算法. GC(请参见

The LOH is probably the main culprit -so trying to reduce or minimize the LOH collections will help.  Also - .NET 4.5 made some huge progress in this respect, and has a much better algorithm for the GC in general, especially the new background server GC (see http://blogs.msdn.com/b/dotnet/archive/2012/07/20/the-net-framework-4-5-includes-new-garbage-collector-enhancements-for-client-and-server-apps.aspx )


这篇关于阻止垃圾收集发生在背景垃圾收集之外.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆