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

          <bdo id='7RhKS'></bdo><ul id='7RhKS'></ul>

      1. <small id='7RhKS'></small><noframes id='7RhKS'>

      2. 我可以(并且我曾经想要)在.net 中设置最大堆大小吗?

        时间:2023-09-13

      3. <legend id='FWu2w'><style id='FWu2w'><dir id='FWu2w'><q id='FWu2w'></q></dir></style></legend>
          • <tfoot id='FWu2w'></tfoot>

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

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

                  本文介绍了我可以(并且我曾经想要)在.net 中设置最大堆大小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  来自 java 背景,我习惯的一件事是告诉 JVM 最大堆大小应该是多少.如果正在运行的程序尝试吞下的资源超出了允许范围,而垃圾收集器无法释放更多资源,则会抛出 OutOfMemoryError 并且一切都会发生.所以设置最大堆大小在 Java 中很重要.

                  Coming from a java background, one of the things I am used to is telling the JVM what the maximum heap size should be. If the running program tries to swallow more than is allowed, and the garbage collector cannot free any more resources, then OutOfMemoryError is thrown and it all goes bang. So setting the maximum heap size is important in Java.

                  这适用于 .net 吗?你能设置堆大小限制吗?CLR 是否会不断增长其堆,直到达到机器的物理极限?或者,由于某种微妙的原因,我的 Java 闪烁器让我看不到,这不是 .net 中的问题吗?

                  Does this apply in .net? Can you set the heap size limits? Does the CLR just keep growing its heap until it reaches the machine's physical limits? Or is it not an issue in .net for some subtle reason that my Java blinkers stop me from seeing?

                  推荐答案

                  您无法在 .Net 中设置最大堆大小,除非您自己在进程中托管 CLR.

                  You can't set max heap size in .Net unless you host the CLR yourself in a process.

                  要控制 CLR 的内存分配,包括最大堆大小,您需要使用托管 api 来托管 clr 并专门使用内存管理器接口",可以在此处找到一些入门信息 MSDN 杂志,CLR 由内而外的专栏:CLR 托管 API

                  To control the memory allocations of CLR including the max heap size, you need to use the hosting api to host the clr and specifically use the "Memory manager interfaces", some starter info can be found here MSDN Magazine, column CLR Inside Out : CLR Hosting APIs

                  回答你的问题,你为什么要控制内存分配或特别是最大堆大小,你通常不想,但是 如果 你正在编写一个应用程序像 SQL Server 或 IIS 或一些实时应用程序,那么你有一个很好的理由来控制内存,特别是避免分页,否则 CLR 本身和操作系统已经为你做了很好的工作,剩下的是为了确保您的应用程序使用最少的资源来正常工作.

                  to answer you question, why would you want to control the memory allocation or specifically max heap size, you usually don't want to, but if you're writing an application that is like SQL Server or IIS or some real time application then you'd have a pretty good reason to have control over memory and specifically, avoid paging, otherwise the CLR itself and the OS already do a pretty good job for you, and what is left is to ensure your that application uses minimum resources for things to work well.

                  这篇关于我可以(并且我曾经想要)在.net 中设置最大堆大小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:我们应该使用“工作站"吗?垃圾收集或“服务器";垃圾收集? 下一篇:VS2015升级后的垃圾收集和Parallel.ForEach问题

                  相关文章

                  1. <legend id='BkxQJ'><style id='BkxQJ'><dir id='BkxQJ'><q id='BkxQJ'></q></dir></style></legend>

                      <bdo id='BkxQJ'></bdo><ul id='BkxQJ'></ul>

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

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