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

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

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

        <tfoot id='bTzka'></tfoot>

        不释放内存是否可以接受

        时间:2023-09-26

          <tbody id='KSJAi'></tbody>

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

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

              • <bdo id='KSJAi'></bdo><ul id='KSJAi'></ul>

                  <legend id='KSJAi'><style id='KSJAi'><dir id='KSJAi'><q id='KSJAi'></q></dir></style></legend>
                • 本文介绍了不释放内存是否可以接受的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在处理一个应该从命令行使用以下语法的项目:

                  I'm working on a project that is supposed to be used from the command line with the following syntax:

                  program-name input-file
                  

                  程序应该处理输入,计算一些东西并在标准输出上输出结果.

                  The program is supposed to process the input, compute some stuff and spit out results on stdout.

                  我选择的语言是 C++,有几个原因我不愿意争论.计算阶段将是高度象征性的(想想编译器),并将使用非常复杂的动态分配的数据结构.特别是,它不适合 RAII 风格的编程.

                  My language of choice is C++ for several reasons I'm not willing to debate. The computation phase will be highly symbolic (think compiler) and will use pretty complex dynamically allocated data structures. In particular, it's not amenable to RAII style programming.

                  我想知道忘记释放内存是否可以接受,因为我希望整个计算消耗的内存少于可用内存,并且操作系统可以在程序完成后一步自由地回收所有内存(假设程序在几秒钟内终止).您对此有何看法?

                  I'm wondering if it is acceptable to forget about freeing memory, given that I expect the entire computation to consume less than the available memory and that the OS is free to reclaim all the memory in one step after the program finishes (assume program terminates in seconds). What are your feeling about this?

                  作为备用计划,如果我的项目需要作为服务器或交互运行,我想我总是可以将垃圾收集器重新安装到源代码中.有没有人有使用 C++ 垃圾收集器的经验?他们工作得好吗?

                  As a backup plan, if ever my project will require to run as a server or interactively, I figured that I can always refit a garbage collector into the source code. Does anyone have experience using garbage collectors for C++? Do they work well?

                  推荐答案

                  在问题描述的具体情况下应该不会造成任何问题.

                  It shouldn't cause any problems in the specific situation described the question.

                  然而,这并不完全正常.静态分析工具会抱怨它.最重要的是,它会养成坏习惯.

                  However, it's not exactly normal. Static analysis tools will complain about it. Most importantly, it builds bad habits.

                  这篇关于不释放内存是否可以接受的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:std::shared_ptr 异常安全 下一篇:构造函数以抛出异常结束?是否存在内存泄漏?

                  相关文章

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

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

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