我如何模拟Windows 7中的低内存条件 [英] How can I simulate a low memory condition in Windows 7

查看:276
本文介绍了我如何模拟Windows 7中的低内存条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用C#编写的应用程序,运行良好,但偶尔会出现错误,我们认为这些错误是由于内存条件不足或与垃圾收集器的交互造成的。



如果任何人有兴趣,这里描述:

无法投射'NHibernate.Impl.ExpandedQueryExpression'类型的对象来键入'NHibernate.Linq.NhLinqExpression'



我想尝试和重现这个调试,但我的开发机器有太多的内存。

我已经删除了页面文件,所以我的虚拟内存被限制在12GB的物理内存所以除了物理删除RAM之外,有没有人对如何在开发环境中模拟低内存条件有任何建议?

编辑:

删除了关于监视垃圾收集器的工具的问题


<您可以使用虚拟机(VPC,VMWare或Virtual Box)并调整内存。



这比bug更可靠。



编辑

这个建议是一种模拟具有较少物理内存的PC的方式。如评论和其他答案中所述,如果您希望调整虚拟内存吃掉,那么在该过程开始时堆将是一个解决方案。


I have an application written in C# that works well, but occasionally in the field gives errors which we believe are due to low memory conditions, or interactions with the garbage collector.

If anyone is interested, it is described here:
Unable to cast object of type 'NHibernate.Impl.ExpandedQueryExpression' to type 'NHibernate.Linq.NhLinqExpression'

I want to try and reproduce this for debugging, but my development machine has too much memory.

I've removed the pagefile so my virtual memory is limited to the 12GBs of physical memory so aside from physically removing ram, does anyone have any suggestions on how to simulate a low memory condition in a development environment?

EDIT:
Removed asking about tools which monitor the garbage collector?

解决方案

You could use a Virtual Machine (VPC, VMWare or Virtual Box) and tune the memory down.

That is more reliable than a bug.

EDIT

This suggestion is a way of simulating a PC with less physical memory. As stated in comments and in other answers, if you are looking to tune down virtual memory 'eating away' the heap at the start of the process would be a solution.

这篇关于我如何模拟Windows 7中的低内存条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆