title: iPython clear cache from within function call?
body: <p>I am having memory issues with iPython, and I find that calling <code>%clear out</code> occasionally clears this out.  It seems to be caching output somewhere within some of the functions that I'm calling.</p>
  
  <p>I would like to build this into my function.  <code>clear out</code> calls:</p>
  
  <pre><code>self.outputcache.flush()
  </code></pre>
  
  <p>How can I get a reference to the iPython shell (<code>self</code> in the above)?  In other words: how can I flush the outputcache in iPython, without using <code>clear</code>?</p>