title: Tracking *maximum* memory usage by a Python function
body: <p>I want to find out what the maximum amount of RAM allocated during the call to a function is (in Python). There are other questions on SO related to tracking RAM usage:</p>
  
  <p><a href="https://stackoverflow.com/questions/110259/python-memory-profiler">Which Python memory profiler is recommended?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/552744/how-do-i-profile-memory-usage-in-python">How do I profile memory usage in Python?</a></p>
  
  <p>but those seem to allow you more to track memory usage at the time the <code>heap()</code> method (in the case of guppy) is called. However, what I want to track is a function in an external library which I can't modify, and which grows to use a lot of RAM but then frees it once the execution of the function is complete. Is there any way to find out what the total amount of RAM used during the function call was?</p>