[Tutor] Memory Leak?

Keith Suda-Cederquist kdsudac at yahoo.com
Thu May 8 00:03:37 CEST 2008


So I started commenting things out until I isolated the problem.  For some reason when I plot some of the data using pylab/matplotlib, then close the figure using pylab.close() the memory doesn't get cleared. (I left this part out of my psedo-code in my previous post--Sorry!).

I followed the advice  on  this page: http://mail.python.org/pipermail/python-list/2006-December/417208.html
and the problem is now gone.

I'm a little confused about the whole memory situation now, but I guess I can move on.  Are these generally known and accepted problems that people just work around?  Can anyone suggest a better way for me to implement plotting using pylab/matplotlib in the future?

Thanks,
Keith

Tony Cappellini <cappy2112 at gmail.com> wrote:  Message: 5
 Date: Wed, 7 May 2008 16:18:23 -0400
 From: "Michael Langford" <mlangford.cs03 at gtalumni.org>
 Subject: Re: [Tutor] Memory Leak?
 To: "Keith Suda-Cederquist" <kdsudac at yahoo.com>
 Cc: Python Tutor List <tutor at python.org>
 Message-ID:
         <82b4f5810805071318r5779e585u3f7497013105d272 at mail.gmail.com>
 Content-Type: text/plain; charset="iso-8859-1"
 
>>You can always make a subclass of the classes you're thinking aren't being
>>garbage collected and put a print statement in their __del__ functions to
>>show you when they are. That will show you if/which objects aren't being
 >>deleted.

Is this reliable or will this just confuse the issue?

Python in a Nutshell states "While gc itself can automatically fix many leaks (as long as you avoid defining __del__ in your classes, since the existence of __del__ can block cyclic garbage collection), your program runs faster if it avoids creating cyclic garbage in the first place
 

 _______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor


       
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile.  Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080507/73e2d42f/attachment.htm>


More information about the Tutor mailing list