title: Maximum Memory a .NET process can allocate
body: <p>What is the maximum memory the garbage collector can allocate for a .NET process? When i compile to x64, Process.GetCurrentProcess.MaxWorkingSet returns about 1,4GB, but when i compile to AnyCPU (x64) the same number is returned. For x64 it should be more like the "Limit" value that is displayed in the Task Manager. How can i get the correct number that will cause OutOfMemory-Exceptions when exceeded in all cases?</p>
  
  <p>Some examples what the method should return: </p>
  
  <p>1) Machine Configuration: x64-Windows, 4GB physical memory, 4GB page file<br>
  -As 64-Bit process: 8GB<br>
  -As 32-Bit process: 1.4GB</p>
  
  <p>2) Machine Configuration: x64-Windows, 1GB physical memory, 2GB page file<br>
  -As 64-Bit process: 3GB<br>
  -As 32-Bit process: 1.4GB</p>
  
  <p>3) Machine Configuration: x32-Windows, 4GB physical memory, 4GB page file<br>
  -As 64-Bit process: Won't happen<br>
  -As 32-Bit process: 1.4GB</p>
  
  <p>4) Machine Configuration: x32-Windows, 512MB physical memory, 512MB page file<br>
  -As 64-Bit process: Won't happen<br>
  -As 32-Bit process: 1.0GB</p>