title: How to clear the cache in Matplotlib for python
body: <p>I need to create lots of figures, then use <code>savefig</code> to save the figure.</p>
  
  <p>But after about 280 pictures, it throws the exception <code>RuntimeError: Could not allocate memory for image</code></p>
  
  <p>Is there some function like <code>clear()</code> in Matplotlib ?</p>