title: Check maximum memory usage of Python program under Windows
body: <p>I would like to obtain, from within the Python program, the maximum physical memory used by a Python program (ActiveState Python 3.2, under Windows 7).</p>
  
  <p>Ideally, every 0.1&nbsp;sec or so, I'd like to have memory usage polled, and if it exceeds the maximum seen so far, the maximum value (a global variable stored somewhere), updated.</p>
  
  <p>UPDATE:</p>
  
  <p>I realize my question is a close duplicate of <a href="https://stackoverflow.com/questions/110259/python-memory-profiler">Which Python memory profiler is recommended?</a>.</p>
  
  <p>Sorry for being unclear. I have two specific problems that are not, to my knowledge, addressed by a regular memory profiler:</p>
  
  <ol>
  <li><p>I need to see not only the memory allocated by Python, but the total memory used by the Python program (under Windows, this would include DLLs, etc.). In other words, under Windows, this is exactly what you'd see in the <a href="http://en.wikipedia.org/wiki/Windows_Task_Manager" rel="nofollow noreferrer">Task Manager</a>.</p></li>
  <li><p>I need to see the maximum memory rather than the memory at any given instant. I can't think of a way to do that other than to place numerous memory checks all around the code whenever I think I'm allocating something large.</p></li>
  </ol>