<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 语句

        Python del statement(Python del 语句)
              <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 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  env: python: No such file or directory(env: python: 没有这样的文件或目录)
                  How to evaluate environment variables into a string in Python?(如何在 Python 中将环境变量评估为字符串?)
                  Python - temporarily modify the current process#39;s environment(Python - 临时修改当前进程的环境)
                  Change current process environment#39;s LD_LIBRARY_PATH(更改当前进程环境的 LD_LIBRARY_PATH)
                  Reading and writing environment variables in Python?(在 Python 中读写环境变量?)
                  When to use sys.path.append and when modifying %PYTHONPATH% is enough(何时使用 sys.path.append 以及何时修改 %PYTHONPATH% 就足够了)
                      <tbody id='ZXJpN'></tbody>

                      <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'>

                          • <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>