title: Getting the memory usage of ALL variables in Python
body: <p>In a Python script, how can I get the memory usage of all variables in memory?</p>
  
  <p>There are a few questions on here about getting the size or memory of a specified object, which is good, but I'm trying to look for the variables using the most memory (since code might be running on a machine with a memory limit and thus it will throw an error if the used memory becomes too high) so I'd like to somehow profile the current state of ALL variables to see which are causing problems by being too big.</p>
  
  <p>Perhaps something inside a loop through the values of <code>locals()</code>, but I'm not sure if there is a performance concern there that another method might avoid.</p>