Limit the available RAM that a program/app sees in Windows

Plain and simple question, just answer if you know.

Is there any command (shortcut command) or app/utility that makes an app/program "see" a specified amount of RAM? Of course modifying the boot ini (maxmem switch) is out of question, don't want to reboot for a handfull of apps.

I have 4gb of RAM, winxp 32bit, and I want to make some apps "think/see" that I have, for example, 2gb RAM; of course Windows will have the whole 4gb RAM, but the specified app is going to think that my max memory is for example 2gb, or 1.5gb or whatever.. Is this possible?

I know already that a 32bit process is limited in 2gb, but some programs/apps have problem with the total amount of RAM.


Solution 1:

You can use Microsoft's Application Verifier. It doesn't give a lot of options for memory management, but allows to run apps in a'resource constrained' environment. It's primary usage is for profiling/debugging, but it can be used just to constrain bad behaving apps.

Additionally for reference:

http://gusclass.com/blog/2011/10/31/application-verifier-save-your-memory-debug-your-apps-also-hax/

Solution 2:

I'm going to assume this is because you have a very old application that doesn't behave properly on a modern computer, or you're a developer and want to test your application on different hardware.

For both cases, I would recommend running the application in a virtual machine. For example, in VirtualBox you can set the amount of system memory (RAM), video memory, and processor cores available. You can change this even after the virtual machine has been created.

If the application is a DOS application, you might also want to take a look at DOSBox.