• <legend id='xaLYM'><style id='xaLYM'><dir id='xaLYM'><q id='xaLYM'></q></dir></style></legend>

    <small id='xaLYM'></small><noframes id='xaLYM'>

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

    <tfoot id='xaLYM'></tfoot>

      1. new Thread() 和垃圾回收

        时间:2023-09-13

          <bdo id='FsFT4'></bdo><ul id='FsFT4'></ul>
          <legend id='FsFT4'><style id='FsFT4'><dir id='FsFT4'><q id='FsFT4'></q></dir></style></legend>

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

                    <tbody id='FsFT4'></tbody>
                • 本文介绍了new Thread() 和垃圾回收的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有以下代码:

                  new Thread(new ThreadStart(delegate()
                  {
                      while (true)
                      {
                          //something
                      }
                  })).Start();
                  

                  垃圾收集器能否在 Running 状态下结束这个 Thread 实例?

                  Can garbage collector finalize this instance of Thread while it is in the Running state?

                  推荐答案

                  CLR 跟踪所有正在运行的线程.只要有对对象的引用,它们就不会被垃圾收集.由于 CLR 保留对所有正在运行的线程的引用,因此 GC 不会触及它们.

                  The CLR keeps track of all running threads. As long as there are references to objects they won't be garbage collected. And since the CLR keeps a reference to all running threads the GC won't touch them.

                  这篇关于new Thread() 和垃圾回收的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:垃圾收集和终结器:更精细的点 下一篇:什么时候需要 Dispose?

                  相关文章

                      <small id='3vdj4'></small><noframes id='3vdj4'>

                      • <bdo id='3vdj4'></bdo><ul id='3vdj4'></ul>

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

                      <legend id='3vdj4'><style id='3vdj4'><dir id='3vdj4'><q id='3vdj4'></q></dir></style></legend>