English 中文(简体)
How do I limit RAM to test low memory situations?
原标题:

I m trying to reproduce a bug that seems to appear when a user is using up a bunch of RAM. What s the best way to either limit the available RAM the computer can use, or fill most of it up? I d prefer to do this without physically removing memory and without running a bunch of arbitrary, memory-intensive programs (ie, Photoshop, Quake, etc).

最佳回答

Use a virtual machine and set resource limits on it to emulate the conditions that you want.

VMWare is one of the leaders in this area and they have a free vmware player that lets you do this.

问题回答

I m copying my answer from a similar question:

If you are testing a native/unmanaged/C++ application you can use AppVerifier and it s Low Resource Simulation setting which will use fault injection to simulate errors in memory allocations (among many other things). It s also really useful for finding a ton of other subtle problems that often lead to application crashes.

You can also use consume.exe, which is part of the Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 Service Pack 1 to easily use a lot of memory, disk space, cpu time, the page file, or kernel pool and see how your application handles the lack of available resources. (Does it crash? How is the performance affected? etc.)

Use either a job object or ulimit(1).

Create a virtual machine and set the ram to what you need.

The one I use is Virtual Box from SUN.

http://www.virtualbox.org/

It is easy to set up.

If you are developing in Java, you can set the memory limits for the JVM at startup.





相关问题
What to look for in performance analyzer in VS 2008

What to look for in performance analyzer in VS 2008 I am using VS Team system and got the performance wizard and reports going. What benchmarks/process do I use? There is a lot of stuff in the ...

SQL Table Size And Query Performance

We have a number of items coming in from a web service; each item containing an unknown number of properties. We are storing them in a database with the following Schema. Items - ItemID - ...

How to speed up Visual Studio 2008? Add more resources?

I m using Visual Studio 2008 (with the latest service pack) I also have ReSharper 4.5 installed. ReSharper Code analysis/ scan is turned off. OS: Windows 7 Enterprise Edition It takes me a long time ...

Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

热门标签