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

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

  • <tfoot id='ewd3Q'></tfoot>

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

        程序终止后动态分配的内存

        时间:2023-07-19

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

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

                  <tbody id='dEArS'></tbody>
                  <tfoot id='dEArS'></tfoot>
                  本文介绍了程序终止后动态分配的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当一个包含动态分配内存(使用 malloc/new)而没有 free/delete 调用的 C/C++ 程序终止时,动态分配的内存会发生什么?操作系统是收回内存还是其他程序无法访问该内存?

                  When a C/C++ program containing the dynamically allocated memory(using malloc/new) without free/delete calls is terminated, what happens to that dynamically allocated memory? Does the operating system takes back the memory or does that memory becomes unaccessible to other programs?

                  推荐答案

                  我不认为语言标准有任何保证,但是支持稀疏虚拟内存和内存保护的现代操作系统(如 MacOS X、Linux、所有最新版本的 Windows 和所有当前制造的手机)在行为不良的进程(当它们终止时)后自动清理并为您释放内存.内存保持不可用,但是只要程序正在运行.

                  I don't think that there are any guarantees in the language standard, but modern operating systems which support sparse virtual memory and memory protection (such as MacOS X, Linux, all recent version of Windows, and all currently manufactured phone handsets) automatically clean up after badly-behaved processes (when they terminate) and free the memory for you. The memory remains unavailable, however as long as the program is running.

                  如果您在微控制器、MacOS 9 或更早版本、DOS 或 Windows 3.x 上进行编程,那么您可能需要担心内存泄漏会导致整个操作系统永久无法使用内存.

                  If you're programming on microcontrollers, on MacOS 9 or earler, DOS, or Windows 3.x, then you might need to be concerned about memory leaks making memory permenantly unavailable to the whole operating system.

                  这篇关于程序终止后动态分配的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我可以将 std::string 传递给 DLL 吗? 下一篇:使用 boost 解析日期时间字符串:使用一位数的小时格式

                  相关文章

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

                        <bdo id='V2Cmc'></bdo><ul id='V2Cmc'></ul>
                    1. <legend id='V2Cmc'><style id='V2Cmc'><dir id='V2Cmc'><q id='V2Cmc'></q></dir></style></legend>
                      <tfoot id='V2Cmc'></tfoot>
                    2. <small id='V2Cmc'></small><noframes id='V2Cmc'>