有没有什么办法pre-分配堆在.NET运行库,就像-​​Xmx / -Xms在Java中?就像、有没有什么、分配、运行库

2023-09-05 02:30:06 作者:别皱眉

在大多数平台上,并与多数JVM可以$ P $通过设置-Xmx和-Xms选项(或其变体)同样大小的P-分配在启动堆。

On most platforms and with most JVMs you can pre-allocate the heap on start-up by setting the -Xmx and -Xms options (or a variant thereof) to the same size.

是否有可能与.NET做同样的,如果是的话,怎么办?

Is it possible to do the same with .NET, and if so, how?

推荐答案

可悲的是不,它不是,.the .NET运行库,使所有关于堆的大小和相对大小辈分决定给你。

Sadly no it's not, .the NET runtime makes all the decisions about heap size and relative generational sizing for you.

你能做的唯一的事情就是垃圾回收器的服务器版本和工作站之一之间切换。这提供了更多的侵略性,在服务器版本的每个核心收集1 GC和preference保持应用程序响应的工作站之一。

The only thing you can do is switch between the server version of the garbage collector and the workstation one. This gives more aggressive, one GC per core collecting in the server version and a preference for keeping the app responsive in the workstation one.