title: Why does 'Any CPU (prefer 32-bit)' allow me to allocate more memory than x86 under .NET 4.5?
body: <p>According to many SO answers and <a href="http://blogs.microsoft.co.il/sasha/2012/04/04/what-anycpu-really-means-as-of-net-45-and-visual-studio-11/" rel="noreferrer">this widely cited blog post</a>, a .NET 4.5 application built for 'Any CPU' with the 'prefer 32-bit' option selected will run as a 32-bit process on both 32-bit and 64-bit systems (unlike in .NET 4.0 and earlier).
  In other words, x86 and AnyCPU with 'prefer 32-bit' selected are equivalent (ignoring whether or not it can run on ARM).</p>
  
  <p>However, my tests have shown that on a 64-bit system an 'AnyCPU prefer 32-bit' application (which I confirm runs 32-bit) can allocate more memory than an x86 one. I wrote a .NET 4.5 C# console app that allocates 10MB byte arrays in a loop (keeping the references of course) until it hits an OutOfMemoryException, and ran it on a 64-bit system with plenty of RAM. When built as x86 it falls over at about 1.2GB allocated. The same code built as 'Any CPU (prefer 32-bit)' gets up to 1.5GB.</p>
  
  <p>Why the difference?</p>