• <i id='RnFb3'><tr id='RnFb3'><dt id='RnFb3'><q id='RnFb3'><span id='RnFb3'><b id='RnFb3'><form id='RnFb3'><ins id='RnFb3'></ins><ul id='RnFb3'></ul><sub id='RnFb3'></sub></form><legend id='RnFb3'></legend><bdo id='RnFb3'><pre id='RnFb3'><center id='RnFb3'></center></pre></bdo></b><th id='RnFb3'></th></span></q></dt></tr></i><div id='RnFb3'><tfoot id='RnFb3'></tfoot><dl id='RnFb3'><fieldset id='RnFb3'></fieldset></dl></div>

      <bdo id='RnFb3'></bdo><ul id='RnFb3'></ul>
  • <small id='RnFb3'></small><noframes id='RnFb3'>

      <legend id='RnFb3'><style id='RnFb3'><dir id='RnFb3'><q id='RnFb3'></q></dir></style></legend>

    1. <tfoot id='RnFb3'></tfoot>
      1. 垃圾收集何时在 C# 中触发?

        时间:2023-09-13
        1. <small id='T1ZYH'></small><noframes id='T1ZYH'>

            <bdo id='T1ZYH'></bdo><ul id='T1ZYH'></ul>
          • <tfoot id='T1ZYH'></tfoot>

                  <tbody id='T1ZYH'></tbody>
              1. <legend id='T1ZYH'><style id='T1ZYH'><dir id='T1ZYH'><q id='T1ZYH'></q></dir></style></legend>
                <i id='T1ZYH'><tr id='T1ZYH'><dt id='T1ZYH'><q id='T1ZYH'><span id='T1ZYH'><b id='T1ZYH'><form id='T1ZYH'><ins id='T1ZYH'></ins><ul id='T1ZYH'></ul><sub id='T1ZYH'></sub></form><legend id='T1ZYH'></legend><bdo id='T1ZYH'><pre id='T1ZYH'><center id='T1ZYH'></center></pre></bdo></b><th id='T1ZYH'></th></span></q></dt></tr></i><div id='T1ZYH'><tfoot id='T1ZYH'></tfoot><dl id='T1ZYH'><fieldset id='T1ZYH'></fieldset></dl></div>
                  本文介绍了垃圾收集何时在 C# 中触发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我读了很多关于垃圾收集的东西,比如它的生成、范围等,但想知道垃圾收集什么时候被触发?如果可能的话,一个例子会很有帮助.

                  I read many things about garbage collection like it's generation, scope etc but want to know when does the garbage collection gets triggered ? an example will be really helpful if possible.

                  谢谢,

                  推荐答案

                  当下列条件之一为真时发生垃圾回收:

                  Garbage collection occurs when one of the following conditions is true:

                  • 系统物理内存不足.
                  • 托管堆上分配的对象使用的内存超过了可接受的阈值.随着流程的运行,此阈值会不断调整.
                  • 调用 GC.Collect 方法.在几乎所有情况下,您都不必调用此方法,因为垃圾收集器会持续运行.此方法主要用于特殊情况和测试.
                  • The system has low physical memory.
                  • The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This threshold is continuously adjusted as the process runs.
                  • The GC.Collect method is called. In almost all cases, you do not have to call this method, because the garbage collector runs continuously. This method is primarily used for unique situations and testing.

                  来源:https://msdn.microsoft.com/en-us/library/ee787088%28v=vs.110%29.aspx#conditions_for_a_garbage_collection

                  这篇关于垃圾收集何时在 C# 中触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:垃圾收集器是否会在 .NET 中的异步调用期间销毁临时未引用的对象? 下一篇:Uwp导航示例和重点控制

                  相关文章

                  <legend id='PREfo'><style id='PREfo'><dir id='PREfo'><q id='PREfo'></q></dir></style></legend>

                • <small id='PREfo'></small><noframes id='PREfo'>

                  <i id='PREfo'><tr id='PREfo'><dt id='PREfo'><q id='PREfo'><span id='PREfo'><b id='PREfo'><form id='PREfo'><ins id='PREfo'></ins><ul id='PREfo'></ul><sub id='PREfo'></sub></form><legend id='PREfo'></legend><bdo id='PREfo'><pre id='PREfo'><center id='PREfo'></center></pre></bdo></b><th id='PREfo'></th></span></q></dt></tr></i><div id='PREfo'><tfoot id='PREfo'></tfoot><dl id='PREfo'><fieldset id='PREfo'></fieldset></dl></div>
                      <tfoot id='PREfo'></tfoot>
                      • <bdo id='PREfo'></bdo><ul id='PREfo'></ul>