SourceForge logo
SourceForge logo
Menu

matplotlib-devel — matplotlib developers

You can subscribe to this list here.

2003 Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
(1)
Nov
(33)
Dec
(20)
2004 Jan
(7)
Feb
(44)
Mar
(51)
Apr
(43)
May
(43)
Jun
(36)
Jul
(61)
Aug
(44)
Sep
(25)
Oct
(82)
Nov
(97)
Dec
(47)
2005 Jan
(77)
Feb
(143)
Mar
(42)
Apr
(31)
May
(93)
Jun
(93)
Jul
(35)
Aug
(78)
Sep
(56)
Oct
(44)
Nov
(72)
Dec
(75)
2006 Jan
(116)
Feb
(99)
Mar
(181)
Apr
(171)
May
(112)
Jun
(86)
Jul
(91)
Aug
(111)
Sep
(77)
Oct
(72)
Nov
(57)
Dec
(51)
2007 Jan
(64)
Feb
(116)
Mar
(70)
Apr
(74)
May
(53)
Jun
(40)
Jul
(519)
Aug
(151)
Sep
(132)
Oct
(74)
Nov
(282)
Dec
(190)
2008 Jan
(141)
Feb
(67)
Mar
(69)
Apr
(96)
May
(227)
Jun
(404)
Jul
(399)
Aug
(96)
Sep
(120)
Oct
(205)
Nov
(126)
Dec
(261)
2009 Jan
(136)
Feb
(136)
Mar
(119)
Apr
(124)
May
(155)
Jun
(98)
Jul
(136)
Aug
(292)
Sep
(174)
Oct
(126)
Nov
(126)
Dec
(79)
2010 Jan
(109)
Feb
(83)
Mar
(139)
Apr
(91)
May
(79)
Jun
(164)
Jul
(184)
Aug
(146)
Sep
(163)
Oct
(128)
Nov
(70)
Dec
(73)
2011 Jan
(235)
Feb
(165)
Mar
(147)
Apr
(86)
May
(74)
Jun
(118)
Jul
(65)
Aug
(75)
Sep
(162)
Oct
(94)
Nov
(48)
Dec
(44)
2012 Jan
(49)
Feb
(40)
Mar
(88)
Apr
(35)
May
(52)
Jun
(69)
Jul
(90)
Aug
(123)
Sep
(112)
Oct
(120)
Nov
(105)
Dec
(116)
2013 Jan
(76)
Feb
(26)
Mar
(78)
Apr
(43)
May
(61)
Jun
(53)
Jul
(147)
Aug
(85)
Sep
(83)
Oct
(122)
Nov
(18)
Dec
(27)
2014 Jan
(58)
Feb
(25)
Mar
(49)
Apr
(17)
May
(29)
Jun
(39)
Jul
(53)
Aug
(52)
Sep
(35)
Oct
(47)
Nov
(110)
Dec
(27)
2015 Jan
(50)
Feb
(93)
Mar
(96)
Apr
(30)
May
(55)
Jun
(83)
Jul
(44)
Aug
(8)
Sep
(5)
Oct
Nov
(1)
Dec
(1)
2016 Jan
Feb
Mar
(1)
Apr
May
Jun
(2)
Jul
Aug
(3)
Sep
(1)
Oct
(3)
Nov
Dec
2017 Jan
Feb
(5)
Mar
Apr
May
Jun
Jul
(3)
Aug
Sep
(7)
Oct
Nov
Dec
2018 Jan
Feb
Mar
Apr
May
Jun
Jul
(2)
Aug
Sep
Oct
Nov
Dec
S M T W T F S




1
(6)
2
(3)
3
(6)
4
(1)
5
6
7
8
(2)
9
(1)
10
11
12
13
(2)
14
(2)
15
16
(6)
17
(3)
18
19
(4)
20
(6)
21
(6)
22
23
(1)
24
25
26
(2)
27
(3)
28
(9)
29
(1)
30
(5)
31
(1)

Showing 9 results of 9

From: Tom H. (NIH/N. [E] <to...@ku...> - 2007年03月28日 20:03:28
In fact, the following loop leaks:
for i in range(indEnd):
 fig = pylab.figure()
about 2k per on my box _even_ with toolbar set to None.
With it set to toolbar2, it is very noticably slower, and leaks 120k per.
-- 
Tom Holroyd, Ph.D.
We experience the world not as it is, but as we expect it to be.
From: Jeff W. <js...@fa...> - 2007年03月28日 18:39:51
Tom Holroyd (NIH/NIMH) [E] wrote:
>> import os,matplotlib
>> matplotlib.use('Agg')
>> from matplotlib.figure import Figure
>> from matplotlib.cbook import report_memory
>>
>> def plot():
>> fig = Figure()
>> i = 0
>> while True:
>> print report_memory(i)
>> fig.clf()
>> ax = fig.add_axes([0.1,0.1,0.7,0.7])
>> ax.plot([1,2,3])
>> i += 1
>>
>> if __name__ == '__main__': plot()
>
> I have matplotlib-0.90.0 installed, and this script doesn't leak for 
> me. It grows a bit as shown in the graph, then stabilizes. I'm on FC4 
> with Python 2.4.3.
>
> ------------------------------------------------------------------------
>
Right - here too (on macos x), it levels off about about 15 times the 
initial memory usage. I just didn't run it long enough to notice that 
before.
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: Christopher B. <Chr...@no...> - 2007年03月28日 18:13:07
You used gnuplot to plot MPL memory use?
for shame, for shame!
;-)
-Chris
Tom Holroyd (NIH/NIMH) [E] wrote:
> as shown in the graph, then stabilizes.
-- 
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chr...@no...
From: Tom H. (NIH/N. [E] <to...@ku...> - 2007年03月28日 17:40:31
Attachments: mem.png
> import os,matplotlib
> matplotlib.use('Agg')
> from matplotlib.figure import Figure
> from matplotlib.cbook import report_memory
> 
> def plot():
> fig = Figure()
> i = 0
> while True:
> print report_memory(i)
> fig.clf()
> ax = fig.add_axes([0.1,0.1,0.7,0.7])
> ax.plot([1,2,3])
> i += 1
> 
> if __name__ == '__main__': plot()
I have matplotlib-0.90.0 installed, and this script doesn't leak for me. It grows a bit as shown in the graph, then stabilizes. I'm on FC4 with Python 2.4.3.
-- 
Tom Holroyd, Ph.D.
We experience the world not as it is, but as we expect it to be.
From: Jeff W. <js...@fa...> - 2007年03月28日 16:43:20
John Hunter wrote:
> On 3/28/07, Jeff Whitaker <js...@fa...> wrote:
>
>> John: I just added macos x support in the report_memory function.
>> Regarding Eric's memory leak #2 (which occurs even for non-gui
>> backends), here's a simple script to trigger it:
>>
>
> Thanks Jeff, could you add this to the unit dir as well?
>
> JDH
Done - added as memleak_nongui.py
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: John H. <jd...@gm...> - 2007年03月28日 16:33:11
On 3/28/07, Jeff Whitaker <js...@fa...> wrote:
> John: I just added macos x support in the report_memory function.
> Regarding Eric's memory leak #2 (which occurs even for non-gui
> backends), here's a simple script to trigger it:
>
Thanks Jeff, could you add this to the unit dir as well?
JDH
From: Jeff W. <js...@fa...> - 2007年03月28日 15:45:43
John Hunter wrote:
> On 3/27/07, Eric Firing <ef...@ha...> wrote:
> 
>> I can add a couple of things to item (1) below. First, the problem
>> occurs only with toolbar2, not with classic or None. Second, a script
>> that illustrates it is attached.
>> 
>
> I defintely agree that this is important -- and it is a big help to
> have a script and the info that you narrowed the problem down to the
> presence of the toolbar. report_memory is platform dependent since ps
> is. I added a report_memory function to cbook so we could have some
> common functionality to rely on. So far it checks for linux or sunos5
> and we should add to this and fix it up as necessary. I also stripped
> the script down to the bare essentials (the memory report) and added
> it to unit/memleak_gui.py so others can use it for testing.
>
> It turns out if you add a savefig call, TkAgg is terribly (1MB per
> figure) and I can reproduce the smaller toolbar induced leak on my
> platform with TkAgg and GTKAgg. I tried adding some code to
> figure.clf to help, but it didn't. I also spent some time trying to
> figure out what was going wrong with TkAgg but unfortunately did not
> succeed. I don't know anything about Tk, really. One interesting
> thing: the enormous filesave leak in TkAgg also only occurs if the
> toolbar is present. w/o the toolbar, neither gtkagg nor tkagg leak w/
> or w/o the filesave. With the toolbar, both leak a 20-80k w/o the
> file save.
>
> Developers: if you know something about a particular GUI, try this
> script with -dYourGUIBackend and see if you can isolate the problem!
>
> JDH
>
> # in svn as unit/memleak_gui.py
>
> #!/usr/bin/env python
> '''
> This illustrates a leak that occurs with any interactive backend.
> Run with
>
> > python memleak_gui.py -dGTKAgg # or TkAgg, etc..
>
> You may need to edit cbook.report_memory to support your platform
>
> '''
> import os, sys, time
> import gc
> import matplotlib
>
> #matplotlib.use('TkAgg') # or TkAgg or WxAgg or QtAgg or Gtk
> matplotlib.rcParams['toolbar'] = 'toolbar2' # None, classic, toolbar2
> #matplotlib.rcParams['toolbar'] = None # None, classic, toolbar2
>
> import pylab
> from matplotlib import _pylab_helpers as ph
> import matplotlib.cbook as cbook
>
> indStart, indEnd = 30, 50
> for i in range(indEnd):
>
> fig = pylab.figure()
> fig.savefig('test')
> fig.clf()
> pylab.close(fig)
> val = cbook.report_memory(i)
> print i, val
> gc.collect()
> if i==indStart: start = val # wait a few cycles for memory usage
> to stabilize
>
> gc.collect()
> print
> print 'uncollectable list:', gc.garbage
> print
> end = val
> if i > indStart:
> print 'Average memory consumed per loop: %1.4fk bytes\n' %
> ((end-start)/float(indEnd-indStart))
> 
John: I just added macos x support in the report_memory function. 
Regarding Eric's memory leak #2 (which occurs even for non-gui 
backends), here's a simple script to trigger it:
import os,matplotlib
matplotlib.use('Agg')
from matplotlib.figure import Figure
from matplotlib.cbook import report_memory
def plot():
 fig = Figure()
 i = 0
 while True:
 print report_memory(i)
 fig.clf()
 ax = fig.add_axes([0.1,0.1,0.7,0.7])
 ax.plot([1,2,3])
 i += 1
if __name__ == '__main__': plot()
-Jeff
-- 
Jeffrey S. Whitaker Phone : (303)497-6313
Meteorologist FAX : (303)497-6449
NOAA/OAR/PSD R/PSD1 Email : Jef...@no...
325 Broadway Office : Skaggs Research Cntr 1D-124
Boulder, CO, USA 80303-3328 Web : http://tinyurl.com/5telg
From: John H. <jd...@gm...> - 2007年03月28日 14:51:32
On 3/27/07, Eric Firing <ef...@ha...> wrote:
> I can add a couple of things to item (1) below. First, the problem
> occurs only with toolbar2, not with classic or None. Second, a script
> that illustrates it is attached.
I defintely agree that this is important -- and it is a big help to
have a script and the info that you narrowed the problem down to the
presence of the toolbar. report_memory is platform dependent since ps
is. I added a report_memory function to cbook so we could have some
common functionality to rely on. So far it checks for linux or sunos5
and we should add to this and fix it up as necessary. I also stripped
the script down to the bare essentials (the memory report) and added
it to unit/memleak_gui.py so others can use it for testing.
It turns out if you add a savefig call, TkAgg is terribly (1MB per
figure) and I can reproduce the smaller toolbar induced leak on my
platform with TkAgg and GTKAgg. I tried adding some code to
figure.clf to help, but it didn't. I also spent some time trying to
figure out what was going wrong with TkAgg but unfortunately did not
succeed. I don't know anything about Tk, really. One interesting
thing: the enormous filesave leak in TkAgg also only occurs if the
toolbar is present. w/o the toolbar, neither gtkagg nor tkagg leak w/
or w/o the filesave. With the toolbar, both leak a 20-80k w/o the
file save.
Developers: if you know something about a particular GUI, try this
script with -dYourGUIBackend and see if you can isolate the problem!
JDH
# in svn as unit/memleak_gui.py
#!/usr/bin/env python
'''
This illustrates a leak that occurs with any interactive backend.
Run with
 > python memleak_gui.py -dGTKAgg # or TkAgg, etc..
You may need to edit cbook.report_memory to support your platform
'''
import os, sys, time
import gc
import matplotlib
#matplotlib.use('TkAgg') # or TkAgg or WxAgg or QtAgg or Gtk
matplotlib.rcParams['toolbar'] = 'toolbar2' # None, classic, toolbar2
#matplotlib.rcParams['toolbar'] = None # None, classic, toolbar2
import pylab
from matplotlib import _pylab_helpers as ph
import matplotlib.cbook as cbook
indStart, indEnd = 30, 50
for i in range(indEnd):
 fig = pylab.figure()
 fig.savefig('test')
 fig.clf()
 pylab.close(fig)
 val = cbook.report_memory(i)
 print i, val
 gc.collect()
 if i==indStart: start = val # wait a few cycles for memory usage
to stabilize
gc.collect()
print
print 'uncollectable list:', gc.garbage
print
end = val
if i > indStart:
 print 'Average memory consumed per loop: %1.4fk bytes\n' %
((end-start)/float(indEnd-indStart))
From: Eric F. <ef...@ha...> - 2007年03月28日 00:24:46
Attachments: mem_minimal.py
I can add a couple of things to item (1) below. First, the problem 
occurs only with toolbar2, not with classic or None. Second, a script 
that illustrates it is attached.
Eric
Eric Firing wrote:
> In 2007, two different major memory leaks have been identified:
> 
> 1) Eric Pellegrini showed that a loop over figure(); close() leaks. I 
> have verified that this occurs with any interactive backend, but not 
> with non-interactive backends. This may be the same problem that was 
> reported in other messages, such as one by Dylan Passmore in January.
> 
> 2) There is a recent thread "Re: Memory leak in basemap or matplotlib" 
> showing that even with a non-interactive backend, a seemingly-pointless 
> call to cla() is needed to prevent a leak.
> 
> I would like to suggest that we try harder to solve these problems ASAP. 
> This kind of malfunctioning at the core of mpl worries me.
> 
> I have spent quite a bit of time trying to figure out (1), and I have 
> tracked it down to the NavigationToolbar2. Eliminate the toolbar by 
> putting None in the rc slot, and the memory leak vanishes. It looks to 
> me like some explicit call to a destroy method may be needed to 
> dismantle the toolbar when a figure is closed and/or deleted. I suspect 
> that each gui toolkit is keeping references to components, and the 
> toolbar is not getting the word when the window is destroyed. 
> gc.garbage verifies that the toolbar components are what get left behind.
> 
> So, I hope a gui toolkit backend wizard can step forward and say, "Of 
> course, we just need to put a __del__ method here with a call to 
> destroy()", or something like that.
> 
> I have spent much less time on (2), and made no progress.
> 
> We are relying very heavily on the gc--mpl has cyclic references all 
> over the place. Is anyone sure that we don't need explicit gc support 
> in any of the extension code? Can *everything* in the extension code be 
> handled correctly with reference counting? Is this independent of how 
> things defined in extension code are used at the python level?
> 
> It is not clear to me that gc debugging methods even allow one to see 
> problems in extension code that do not have some degree of gc support. 
> The standard documentation of the gc module and the gc C API is minimal.
> 
> Eric
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Matplotlib-devel mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Showing 9 results of 9

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /