views:

107

answers:

2

I've written a little application for consuming memory either on disk, or RAM. The reasoning behind this is to test how certain parts of the application behave with small amounts of memory and testing various installers etc. with low disk space. It's quite useful, however currently I've had to limit them to 2Gb.

Unfortunately sometimes I need to consumer more than just 2Gb and have to open the application up several times which is rather annoying. So simply, is there a way I can get around this 2Gb limitation on 32bit OS's?

+3  A: 

As far as eating disk space, you can go over the 2GB barrier by creating multiple files, instead of just one. For memory, you might consider having the process automatically spawn enough child processes to consume the amount of RAM you're trying to eat.

Adam Maras
Ah, that's true. Hadn't thought about using separate processes.
Ian
+3  A: 

For files on disk, you shouldn't be limited to 2GB, what format are the disks using?

  • FAT = 4GB
  • NTFS = 16TB

The .NET memory model is subject to the same limits of all applications. Nominally this is 2GB per application on a 32-bit operating system. There are some generic options which may allow you to increase this.

  1. The /3GB switch in the boot.ini increases the 2Gb to 3GB.
  2. PAE (Physical Address Extensions) which allows you to access memory above 4GB in a page-switching method. You would normally need to write support for this yourself (or hope Microsoft have done it for you in the framework/CLR).

See this detailed description of your options (for Windows in general).

Ray Hayes
"or hope Microsoft have done it for you in the framework/CLR". I remember reading they haven't. Can't remember the source though.
Joren