.NET - 有没有办法来改变整个机器的GC行为? [英] .NET - Is there a way to change the GC behavior for the entire machine?
问题描述
一个同事说,这是可能的(但看起来有点怪我)。
如果有一种方法可以做到这一点,我在这里可以这样做?
我说的是winXP的操作系统。
A co-worker said this is possible (but it looks a bit strange to me).
If there's a way to do it, where can I do this?
I'm talking about winXP OS.
推荐答案
是的,GC有两种操作模式:服务器和工作站。您可以更改或者您的app.config中(每个应用程序)或machine.config的模式。请参见 http://blogs.msdn.com/junfeng/archive/ 2004年/ 07/13 / 181534.aspx 了解详情。
Yes, the GC has two modes of operation: Server and Workstation. You can change modes in either your app.config (per application) or machine.config. See http://blogs.msdn.com/junfeng/archive/2004/07/13/181534.aspx for more information.
<Configuration>
<runtime>
<gcServer enabled="false" />
<gcConcurrent enabled="true" />
</runtime>
</Configuration>
- 假 - 不运行服务器的垃圾收集。 这是默认的。的
- 真正 - 运行服务器垃圾回收
- false - Does not run server garbage collection. This is the default.
- true - Runs server garbage collection.
- 假 - 不运行垃圾收集并发
- 真正 - 运行垃圾收集并发。 这是默认的。的
- false - Does not run garbage collection concurrently.
- true - Runs garbage collection concurrently. This is the default.
在一般情况下,然而,你不希望,除非你有一个的的真正的 真的的很好的理由。普遍认为,关心这个唯一的东西是被托管的CLR自己非托管的应用程序(如SQL Server或IIS)。
In general, however, you don't want to change the GC operation mode, especially on a machine level unless you have a really, really good reason to. Generally the only things that care about this are unmanaged applications that are hosting the CLR themselves (such as SQL Server or IIS).
这篇关于.NET - 有没有办法来改变整个机器的GC行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!