<bdo id='cIFwo'></bdo><ul id='cIFwo'></ul>
    1. <small id='cIFwo'></small><noframes id='cIFwo'>

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

        垃圾收集与非垃圾收集编程语言

        时间:2023-07-12

        <tfoot id='dI76q'></tfoot>
            <tbody id='dI76q'></tbody>
            <bdo id='dI76q'></bdo><ul id='dI76q'></ul>
          • <legend id='dI76q'><style id='dI76q'><dir id='dI76q'><q id='dI76q'></q></dir></style></legend>

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

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

                1. 本文介绍了垃圾收集与非垃圾收集编程语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以如果我理解得很好,垃圾收集会自动释放程序不再使用的对象.就像java中的垃圾收集器.

                  So if I understand well, Garbage collection automatically deallocates objects that are not used by the program anymore. like the garbage collector in java.

                  我听说在不支持垃圾回收的 C 等语言中,程序可能会发生内存泄漏并随后耗尽内存.

                  I hear in languages like C that don't support garbage collection the programs can have memory leaks and subsequently exhaust the memory.

                  那么程序员在不支持垃圾收集的 C 等语言中犯了什么错误?我猜想在不再使用对象后不会释放对象.但是,由于缺少垃圾收集器,我们会犯的唯一错误是这些吗?

                  So what are the errors that programmer make in languages like C that don't support garbage collection? I would guess not deallocating objects after they're not used anymore. But are these the only errors that we can make because of the lack of a garbage collector?

                  推荐答案

                  • 描述你需要的东西

                    • Dellocating things you need

                      不释放你不再需要的东西(因为你没有很好地跟踪分配/使用/释放)

                      Not deallocating things you no longer need (because you're not tracking allocations/use/frees well)

                      重新分配已存在事物的新实例(未正确跟踪的副作用)

                      Re-allocating new instances of things that already exist (a side-effect of not tracking properly)

                      取消分配你已经释放的东西

                      De-allocating something you've already freed

                      取消分配不存在的东西(空指针)

                      De-allocating something that doesn't exist (a null pointer)

                      可能还有更多.关键是:管理内存很棘手,最好使用某种跟踪机制和分配/释放抽象来处理.因此,您不妨将其内置到您的语言中,这样它就可以让您轻松自如.手动内存管理并不是世界末日——它当然是可行的——但现在,除非你正在编写实时代码、硬件驱动程序,或者(也许,可能)最新的超优化核心代码游戏,那么除了作为一项学术练习之外,手动工作是不值得的.

                      There are probably more. The point is: managing memory is tricky, and is best dealt with using some sort of tracking mechanism and allocating/freeing abstraction. As such, you might as well have that built into your language, so it can make it nice and easy for you. Manual memory management isn't the end of the world -- it's certainly doable -- but these days, unless you're writing real-time code, hardware drivers, or (maybe, possibly) the ultra-optimised core code of the latest game, then manual effort isn't worth it, except as an academic exercise.

                      这篇关于垃圾收集与非垃圾收集编程语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:并发标记和扫描算法详细信息 下一篇:在 Java 中如何将对象标记为 finalized(以便第二次不会调用 finalize 方法)?

                  相关文章

                  1. <legend id='ATJ4q'><style id='ATJ4q'><dir id='ATJ4q'><q id='ATJ4q'></q></dir></style></legend>
                      • <bdo id='ATJ4q'></bdo><ul id='ATJ4q'></ul>
                      <tfoot id='ATJ4q'></tfoot>

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