title: Windows - WPF Process out of memory crash with plenty of available physical memory
body: <p>i have a WPF desktop app that crashed with the following exception:</p>
  
  <blockquote>
    <p>System.Data.SqlServerCe.SqlCeException (0x80004005): There is not enough memory on the device running SQL Server</p>
  </blockquote>
  
  <p>However, the memory values at crash time are somewhat not clear to me:</p>
  
  <ul>
  <li>Current Process Current Working Set: 806 MB</li>
  <li>Current Process Peak Working Set: 1157 MB</li>
  <li>Current Process Current Page Memory Size: 779 MB</li>
  <li>Current Process Peak Page Memory Size: 1502 MB</li>
  <li>Current Process Private Memory Size: 779 MB</li>
  <li>ComputerInfo TotalPhysicalMemory: 5884 MB</li>
  <li>ComputerInfo TotalVirtualMemory: 2047 MB</li>
  <li>ComputerInfo AvailablePhysicalMemory: 3378 MB</li>
  <li>ComputerInfo AvailableVirtualMemory: 166 MB</li>
  </ul>
  
  <p>btw. The Current Process values are taken from the C# Process class. The ComputerInfo values are taken from the VB.NET ComputerInfo class.</p>
  
  <p>My app is compiled with (x86) configuration. The process is running on a Windows 7 64 Bit machine.</p>
  
  <p>I see that the Available Virtual Memory is 166MB which looks pretty low. </p>
  
  <p>How is it possible that the process crashed when there is plenty of AvailablePhysicalMemory reported by the VB.NET ComputerInfo class?.. </p>
  
  <p>The high Current and Peak Working Set indicates that probably there is a memory leak somewhere, but i still don't get why it crashed when there was plenty of available RAM.</p>