[IPython-dev] memory leak?
Jörgen Stenarson
jorgen.stenarson at bostream.nu
Tue Apr 11 14:11:28 EDT 2006
Ville Vainio skrev:
> On 4/8/06, Hans Meine <hans_meine at gmx.net> wrote:
>
>> Sth. like the following would be great:
>>
>> %clearout - clear whole cache
>> %clearout 112 - clear one line
>> %clearout :100 140:150 113 - clear multiple (sub)ranges
>
> Now
>
> %clear in
> %clear out
>
> works in SVN. At this point I didn't see it necessary to support
> specifically targeted clears, typically users will probably store
> valueable (non-throwaway) output cache data in variables anyway.
>
> --
> Ville Vainio - vivainio.googlepages.com
> vainio.blogspot.com - g[mail | talk]='vivainio'
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.net
> http://scipy.net/mailman/listinfo/ipython-dev
>
Ville,
I think there is one more thing that needs clearing and that is the
entries list in the outputcache object. In my attached patch I have
removed it completely because I could not see that it was used for
anything use for it. I have also attached a patch for another option to
the clear command:
%clear array which will delete all arrays from the user_ns namespace
if ipython was started in -pylab mode. Arrays are determined by
pylab.arraytype.
There is still some strangeness in the garbage collection process
though. If I run
In[1] %run some_script.py
In[2] a #array variable in script
Out[2] array(...)
In[3] %run some_script.py
In[4] a #array variable in script
Out[4] array(...)
In[5] %run some_script.py
In[5] a #array variable in script
Out[5] array(...)
In[6] %run some_script.py
In[7]%clear out
I get back some memory. If I then run gc.collect() a few times at the
prompt I will get back some more for each call to gc.collect() this will
stabilize after a few calls. I'm not sure what the reason is but I
thought I should mention it.
/Jörgen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ipython_clear.patch
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20060411/72c9cc33/attachment.ksh>
More information about the IPython-dev
mailing list