3

I have an application running on Windows 2003 x86 with PAE. OS has 8 GB RAM. During application running some memory is allocated and after the host process grows up to ~1GB and total system memory grows up more than 4GB I got an OOM exception.

At that time there is about 4GB RAM free, about 1GB to 2GB limit for a single process.

So the question is: if I have enough free memory, where would be the source of this exception?

Kara
  • 5,650
  • 15
  • 48
  • 55
blsrmn
  • 43
  • 4
  • Arrays must be a single contiguous block of memory in the program address space, your program might only be consuming a total of 1GB of memory but that is spread across maybe 3GB of address space. See: http://stackoverflow.com/a/14835279/288747 – Seph Nov 25 '13 at 10:01
  • 1
    Do you run 32 or 64 bit? – weismat Nov 25 '13 at 10:31
  • AFAIK, PAE extends usable memory to 3GB instead if 2GB. It does not remove all limits. – usr Nov 25 '13 at 11:34
  • 2
    PAE is the olden bank-switching trick. It is completely incompatible with a garbage collector so .NET does not support it. Take advantage of all that nice RAM you have by updating the machine to the 64-bit version of Windows. – Hans Passant Nov 25 '13 at 13:45

2 Answers2

0

Remember that answering to the question 'how much memory is my program using?' is no so simple and answer depends on which counters do you measure.

I would check from start to monitor your application with usage of Process Monitor tool and watch:

  • Private Bytes
  • Working Set
  • Virtual Bytes

Look also to that question to find more details about different memory usage indicators.

As I am also a big fan of WinDbg, I would take a full memory dump of the process when OOM exception occurs and analyze it in details.

Community
  • 1
  • 1
Konrad Kokosa
  • 15,790
  • 2
  • 33
  • 54
0

What counts is not how much memory the system has available, rather what matters is how much memory your process has available. Since your process is a 32 bit process there is a hard limit of 4GB.

So you don't have 4GB free memory, the system does. You have used your allocation of 4GB and you are out of memory.

The only way forward is to move to a 64 bit process. Clearly that requires a 64 bit system.

David Heffernan
  • 572,264
  • 40
  • 974
  • 1,389