开发者

Restricting .Net CLR memory usage

开发者 https://www.devze.com 2023-01-28 20:12 出处:网络
Ok, so here\'s the problem.In our production environment (ASP.Net) our servers have a massive amount of memory as well as a massive number of users / sessions.My computer has 8 gigs, and I\'m the only

Ok, so here's the problem. In our production environment (ASP.Net) our servers have a massive amount of memory as well as a massive number of users / sessions. My computer has 8 gigs, and I'm the only user. In production, we're (rarely) getting a System.OutOfMemoryException.

With that background information, here is the question: is it possible to make the CLR think I only have a gig of memory or less? IIRC, there's a command-line option to do this for Java.

Another option is to make some really big objects to fill up memory to simulate low memory conditions. But that requires modifying the assemblies and the huge objects might be cached to disk.

Recommendations? Or开发者_JS百科 other options?


One way to simulate a lower-memory/resource system is to create a system virtual machine and allocate the specific amount of memory you want it to have. Both VMWare and MS Virtual Machines have this feature.

Besides a simulation of a lower-resource machine VMs are also a great way to manage your test environments.


Whether or not your program recieves an OutOfMemoryException is independent of how much RAM is on your machine. OutOfMemoryException means the process has run out of virtual memory which is the same for every process independent of physical RAM

There are a couple of items which can affect the amount of virtual memory in a process

  • 32 vs 64 bit process
  • Switches like /LargeAddressAware (Documentation)

Best guess is the server is a 64 bit process while the client machine is 32

0

精彩评论

暂无评论...
验证码 换一张
取 消