title: What's the Best Way to Measure Memory Use from a Program?
body: <p>I've been trying to optimize the Windows program I am developing, trying to find the best data structures that will minimize memory use. It loads large blocks of data, so with huge files, it can use a large amount of RAM.</p>
  
  <p>For memory measurement, I have been using GlobalMemoryStatusEx. See: <a href="http://msdn.microsoft.com/en-us/library/aa366589(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa366589(VS.85).aspx</a> </p>
  
  <p>I believe this works for most flavors of Windows, from Windows 2000 right up to and including Windows Vista. </p>
  
  <p>Is this the preferred way to measure memory use from within a program, or is there another, better way?</p>
  
  <hr>
  
  <p>Addenum:  Found the Stackoverflow question: <a href="https://stackoverflow.com/questions/282194/how-to-get-memory-usage-under-windows-in-c">How to get memory usage under Windows in C++</a> which references <a href="http://msdn.microsoft.com/en-us/library/ms683219.aspx" rel="nofollow noreferrer">GetProcessMemoryInfo</a></p>
  
  <p>I'll try that one out.</p>