确定哪些垃圾收集器运行 [英] Determining which garbage collector is running

查看:187
本文介绍了确定哪些垃圾收集器运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行的Windows Server 2003 64位(2个至强4核特效)大.NET 4.0的x86应用程序,并正在运行到哪里我的应用程序〜每日2-3次冻结30秒的问题,然后恢复运行为正常。该应用程序只重启每周一次,并消耗400-800 MB的内存,所以我假定这些冻结的垃圾收集。我只看到日志中的结冰,不活,或者我会检查任务管理器来确认。

I am running a large .net 4.0 x86 app on Windows Server 2003 x64 (2x Xeon 4 core procs), and am running into issues where my app ~2-3 times a day freezes for 30 seconds, and then resumes functioning as normal. The application is only rebooted once a week, and consumes 400-800 mb of memory, so I am assuming these freezes are Garbage Collection. I am only seeing the freezes in the logs, not live, or I would check the Task Manager to confirm.

我试图找出其中的.Net 4 GC运行,以及如何可以切换GC到新的并发后台GC如果不是,或如何确认这些其实都是地方选区(procmon中不显示WIN2K3服务器的.Net工具)。

I am trying to figure out which .Net 4 GC is running, and how to either switch the GC to the new concurrent background gc if it isn't, or how to confirm these are in fact GCs (Procmon doesn't show .Net instruments in Win2k3 server).

推荐答案

您在Windows的服务器版本上运行,你会得到垃圾收集器的服务器版本默认。哪些没有做背景的集合,垃圾是由多个线程收集所以偶尔可观察到的停顿也不在少数。您可以强制工作站版本与app.exe.config文件:

You are running on the server version of Windows, you'll get the server version of the garbage collector by default. Which doesn't do background collections, garbage is collected by multiple threads so occasional observable pauses are not unusual. You can force the workstation version with an app.exe.config file:

<configuration>
   <runtime>
      <gcServer enabled="false"/>
   </runtime>
</configuration>

此外,还查看文档的 GC.RegisterForFullGCNotification()< /一>方法,该方法来处理暂停的副作用

Also review the docs for the GC.RegisterForFullGCNotification() method for a way to deal with the side-effect of the pauses.

.NET 4.5版本将支持后台收集服务器GC。

.NET version 4.5 will support background collections for the server GC.

这篇关于确定哪些垃圾收集器运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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