i forgot two imports.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
import math
import gc
import pylab as PL


def looptest():
    while(1):
        fig=PL.figure(1)
        ax=fig.add_subplot(211)
        ax.set_position((0,0,0.9,0.45))
        ax1=PL.twinx(ax)
        t=range(1000)
        st=[math.sin(x*0.01) for x in t]
        ax.plot(t,st)
        fig.clf()
        PL.close(1)
        gc.collect()
        print "GC"
        print len(gc.get_objects())
        print len(gc.garbage)
looptest()
>>>>>>>>>>>>>>>>>>>>>>>>>>>>

2008/7/11 laurent oget <[EMAIL PROTECTED]>:

> I think i narrowed down the memory leak i have been chasing for a while.
> If i remove the call to twinx i get a slow leak, which would cause me
> trouble
> after a very long time. With the call to  twinx, however i am losing
> thousands of objects
> at each loop.
>
> Thanks,
>
> Laurent
>
>
> >>>>>>>>>>>>>>>>>>>>>>>>>
> import pylab as PL
> def looptest():
>     while(1):
>         fig=PL.figure(1)
>         ax=fig.add_subplot(211)
>         ax.set_position((0,0,0.9,0.45))
>         ax1=PL.twinx(ax)
>         t=range(1000)
>         st=[math.sin(x*0.01) for x in t]
>         ax.plot(t,st)
>         fig.clf()
>         PL.close(1)
>         gc.collect()
>         print "GC"
>         print len(gc.get_objects())
>         print len(gc.garbage)
> looptest()
> >>>>>>>>>>>>>>>>>>>>>>>>>>>
>
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to