user79755
user79755

Reputation: 2731

Configure .NET CLR RAM usage

Is there a method of configuring the .NET CLR RAM usage on my machine?

Suppose I have 64GB of RAM and I want to limit it to 4GB? It this possible?

Edit - The root of the problem is that I have a 64-bit application that runs fine on a 64bit - 4GB machine but when run on a 64bit - 64GB machine it fails (stops dead in it's tracks when allocating memory). I'm thinking memory fragmentation is the cause as the application attempts to allocate up to 8GB chunks if there is enough RAM available otherwise it breaks the allocations down to much smaller chunks. So I would have to configure the application to always use small chunks?

Upvotes: 2

Views: 2122

Answers (2)

Robert Venables
Robert Venables

Reputation: 5971

Have at look at the machine.config file in

%SystemRoot%\Microsoft.NET\Framework[version]\CONFIG

The memoryLimit attribute controls the percentage of physical memory that a process is allowed to consume. I know this is not exactly what you are looking for but the closest I could find.

Upvotes: 2

jrista
jrista

Reputation: 32950

You might want to look into using PublicDomain. It is a library that exposes a lot of lower level capabilities, such as spawning processes with memory limits. There is actually a CodeProject article that describes how to do exactly that with PublicDomain:

http://www.codeproject.com/KB/threads/Setting_Max_Memory_Limit.aspx

Upvotes: 0

Related Questions