限制.NET CLR内存使用情况内存、情况、NET、CLR

2023-09-05 00:26:22 作者:你真逗丶

好了,所以这里的问题。在我们的生产环境(ASP.Net)我们的服务器有大量的内存量以及用户/会话的数量庞大。我的电脑有8音乐会,而我是唯一的用户。在生产中,我们(很少)得到一个的System.OutOfMemoryException

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.

使用的背景资料,这里的问题:是否有可能使CLR觉得我只有内存或更小的演出? IIRC,有一个命令行选项来做到这一点的Java语言。

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 other options?

推荐答案

模拟低内存/资源系统的一种方法是创建一个的系统虚拟机并分配的内存,你希望它有具体金额。 VMware和MS虚拟机都具有此功能。

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.