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

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

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

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

        Python del 语句

        时间:2023-07-05
              <bdo id='dfxXT'></bdo><ul id='dfxXT'></ul>
            • <small id='dfxXT'></small><noframes id='dfxXT'>

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

                1. <tfoot id='dfxXT'></tfoot>
                2. 本文介绍了Python del 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在 Python 中对变量调用 del.这会立即释放分配的内存还是仍在等待垃圾收集器收集?和 java 一样,显式调用 del 对何时释放内存没有影响.

                  Calling del on a variable in Python. Does this free the allocated memory immediately or still waiting for garbage collector to collect? Like in java, explicitly calling del has no effect on when the memory will be freed.

                  推荐答案

                  del 语句不回收内存.它删除了一个引用,这会减少该值的引用计数.如果计数为零,则可以回收内存.CPython 会立即回收内存,无需等待垃圾收集器运行.

                  The del statement doesn't reclaim memory. It removes a reference, which decrements the reference count on the value. If the count is zero, the memory can be reclaimed. CPython will reclaim the memory immediately, there's no need to wait for the garbage collector to run.

                  其实垃圾回收器只是回收循环结构时才需要的.

                  In fact, the garbage collector is only needed for reclaiming cyclic structures.

                  正如 Waleed Khan 在他的评论中所说,Python 内存管理可以正常工作,您不必担心.

                  As Waleed Khan says in his comment, Python memory management just works, you don't have to worry about it.

                  这篇关于Python del 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:为什么python对gc同时使用引用计数和mark-and-sweep? 下一篇:如何在 Python 中删除对象的每个引用?

                  相关文章

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

                    1. <tfoot id='ZXJpN'></tfoot>
                      • <bdo id='ZXJpN'></bdo><ul id='ZXJpN'></ul>

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

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