Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to pre-allocate the heap in the .NET runtime, like -Xmx/-Xms in Java?

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.

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

like image 734
sam_pointer Avatar asked Feb 10 '10 11:02

sam_pointer


People also ask

What is Loh memory?

When an object is large, some of its attributes become more significant than if the object is small. For instance, compacting it—that is, copying it in memory elsewhere on the heap—can be expensive. Because of this, the garbage collector places large objects on the large object heap (LOH).

Why .NET 6 is faster?

NET 6 sees an unbelievable number of performance improvements finding their way into the JIT (just-in-time compiler), which is used to translate IL (intermediate language) into assembly code at run-time, and which is also used for AOT (ahead-of-time compilation) as part of Crossgen2 and the R2R format (ReadyToRun).

Is .NET 6 production ready?

NET 6 and we've heard great early results in production. . NET 6 is ready for your app. You can download . NET 6 for Linux, macOS, and Windows.

What is .NET garbage collection?

NET's garbage collector manages the allocation and release of memory for your application. Each time you create a new object, the common language runtime allocates memory for the object from the managed heap.


1 Answers

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

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.

like image 145
Paolo Avatar answered Sep 19 '22 04:09

Paolo