<tfoot id='XvcFq'></tfoot>
        <bdo id='XvcFq'></bdo><ul id='XvcFq'></ul>

    1. <small id='XvcFq'></small><noframes id='XvcFq'>

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

      1. 限制 C# 应用程序中托管堆的大小

        时间:2023-10-07
      2. <legend id='AeHP0'><style id='AeHP0'><dir id='AeHP0'><q id='AeHP0'></q></dir></style></legend>
      3. <small id='AeHP0'></small><noframes id='AeHP0'>

          • <tfoot id='AeHP0'></tfoot>
            <i id='AeHP0'><tr id='AeHP0'><dt id='AeHP0'><q id='AeHP0'><span id='AeHP0'><b id='AeHP0'><form id='AeHP0'><ins id='AeHP0'></ins><ul id='AeHP0'></ul><sub id='AeHP0'></sub></form><legend id='AeHP0'></legend><bdo id='AeHP0'><pre id='AeHP0'><center id='AeHP0'></center></pre></bdo></b><th id='AeHP0'></th></span></q></dt></tr></i><div id='AeHP0'><tfoot id='AeHP0'></tfoot><dl id='AeHP0'><fieldset id='AeHP0'></fieldset></dl></div>
                <bdo id='AeHP0'></bdo><ul id='AeHP0'></ul>
                    <tbody id='AeHP0'></tbody>
                  本文介绍了限制 C# 应用程序中托管堆的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我能否配置我的 C# 应用程序以将其内存消耗限制为 200MB?IOW,我不想等待自动 GC(这似乎使堆增长得比这个应用程序实际需要的多得多).

                  Can I configure my C# application to limit its memory consumption to, say, 200MB? IOW, I don't want to wait for the automatic GC (which seems to allow the heap to grow much more than actually needed by this application).

                  我知道在 Java 中有一个命令行开关可以传递给实现此目的的 JVM.在 C# 中是否有等价物?

                  I know that in Java there's a command line switch you can pass to the JVM that achieves this.. is there an equivalent in C#?

                  附言

                  我知道我可以从代码中调用 GC,但我不想定期这样做.我宁愿在启动时设置一次然后忘记它.

                  I know that I can invoke the GC from code, but that's something I would rather not have to do periodically. I'd rather set it once upon startup somehow and forget it.

                  推荐答案

                  我不知道常规 CLR 有任何此类选项.我想如果你实现自己的 CLR 主机,你可以控制它.

                  I am not aware of any such options for the regular CLR. I would imagine that you can control this if you implement your own CLR host.

                  但是,我不同意您对堆增长方式的评估.堆增长是因为您的应用程序正在分配和持有对象.

                  However, I disagree in your assessment of how the heap grows. The heap grows because your application is allocating and holding on to objects.

                  您可以采取一些措施来限制内存使用量.请参阅此问题以获取一些输入:减少 .NET 应用程序的内存使用?

                  There are a couple of things you can do to limit the memory usage. Please see this question for some input: Reducing memory usage of .NET applications?

                  这篇关于限制 C# 应用程序中托管堆的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:.Net Garbage 是否会收集未引用但具有正在工作的线程的对象? 下一篇:用于服务器的 C# GC

                  相关文章

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

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