.NET - Is there a way to change the GC behavior for the entire machine?

…衆ロ難τιáo~ 提交于 2019-12-11 02:21:34

问题


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.


回答1:


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>

For gcServer:

  • false - Does not run server garbage collection. This is the default.
  • true - Runs server garbage collection.

For gcConcurrent:

  • false - Does not run garbage collection concurrently.
  • true - Runs garbage collection concurrently. This is the default.

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).



来源:https://stackoverflow.com/questions/1267611/net-is-there-a-way-to-change-the-gc-behavior-for-the-entire-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!