(sorry for my English)
The following code in Python causes leakage of memory:
################################################################
from pylab import *
import pygtk
pygtk.require('2.0')
import gtk
import matplotlib
matplotlib.use('GTKAgg') # or 'GTK'
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
from matplotlib.figure import Figure
for i in range(200):
fig = Figure(figsize=(1,1))
canvas = FigureCanvas(fig)
axes = fig.add_subplot(111)
axes.grid(True)
ind = arange(200)
xx = rand(len(ind))
line= axes.plot(ind, xx)
canvas.show_all()
line[0].set_data(ind, xx)
canvas.draw()
line = None
axes.clear()
fig.delaxes(axes)
fig.clear()
fig = None
axes = None
canvas.destroy()
canvas = None
#####################################################
And next lines too (but smaller):
######################################################
fig = Figure(figsize=(1,1))
canvas = FigureCanvas(fig)
axes = fig.add_subplot(111)
axes.grid(True)
ind = arange(200)
xx = rand(len(ind))
line= axes.plot(ind, xx)
canvas.show_all()
for i in range(200):
canvas.draw()
#######################################################
How can I correct it?
Yours faithfully,
Andrey
-------------------------------------------------------------------------
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-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users