line 1245 of cbook.py is missing the windows platform. So windows cannot be
tested.
def report_memory(i=0): # argument may go away
'return the memory consumed by process'
from subprocess import Popen, PIPE
pid = os.getpid()
if sys.platform=='sunos5':
a2 = Popen('ps -p %d -o osz' % pid, shell=True,
stdout=PIPE).stdout.readlines()
mem = int(a2[-1].strip())
elif sys.platform.startswith('linux'):
a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True,
stdout=PIPE).stdout.readlines()
mem = int(a2[1].split()[1])
elif sys.platform.startswith('darwin'):
a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
stdout=PIPE).stdout.readlines()
mem = int(a2[1].split()[0])
return mem
--- On Thu, 6/16/11, zb <zaub...@yahoo.com> wrote:
From: zb <zaub...@yahoo.com>
Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak
To: "Eric Firing" <efir...@hawaii.edu>, matplotlib-users@lists.sourceforge.net
Date: Thursday, June 16, 2011, 10:15 AM
Hi.
Sorry but that program does not even run. I am using
matplotlib-1.0.1.win32-py2.6.exe
It breaks with the error (I had to modified a little to get the full error):
UnboundLocalError: local variable 'mem' referenced before assignment
Traceback (most recent call last):
File...
File "C:\Python26\lib\site-packages\matplotlib\cbook.py", line 1245, in
report_memory
return mem
Looks like you are using a different matplotlib version.
Cheers
--- On Wed, 6/15/11, Eric Firing <efir...@hawaii.edu> wrote:
From: Eric Firing <efir...@hawaii.edu>
Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak
To:
matplotlib-users@lists.sourceforge.net
Date: Wednesday, June 15, 2011, 7:46 PM
On 06/15/2011 01:15 PM, zb wrote:
> Hi
>
> You could try the example here:
>
> http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_qt4.html
>
> Look at the memory grow. It does the same in my program.
I added a call to cbook.report_memory, and shortened the timer to 0.1
seconds in the attached version.
There is no memory leakage evident when I run this on my system.
Eric
>
> Cheers
>
> --- On *Wed, 6/15/11, Eric Firing /<efir...@hawaii.edu>/* wrote:
>
>
> From: Eric Firing <efir...@hawaii.edu>
> Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak
> To: matplotlib-users@lists.sourceforge.net
> Date: Wednesday, June 15, 2011, 6:33 PM
>
> On 06/15/2011 12:13 PM, zb wrote:
> > Hi
> >
> > I have a loop that updates a graph by calling
> >
> > self.fig.canvas.draw()
> >
> > But every time it updates the graph, the memory usage goes up. If the
> > program runs
for one hour, the memory is gone (things start to
> run slow
> > too). I've tried to close() objects but the only thing that
> brings back
> > the ram memory is to close the whole application.
> >
> > I have read this note in the documentation (but it applies to
> pyplot):
> >
> > "If you are making a long sequence of figures, you need to be
> aware of
> > one more thing: the memory requiredfor a figure is not completely
> > released until the figure is explicitly closed with close(). Deleting
> > all references to the figure, and/or using the window manager to kill
>
> the window in which the figure appears on the screen, is not enough,
> > because pyplot maintains internal references until close() is
> called."
> >
> > What could I do in pyqt4 to release the memory?
> >
> > Thanks
>
> Please provide a simple standalone script that demonstrates the problem.
>
> Eric
>
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
-----Inline Attachment Follows-----
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
-----Inline Attachment Follows-----
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
-----Inline Attachment Follows-----
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users