Hello all. I have a snippet of code which seems to indicate a memory
leak when run using python 2.4 (not tested under other versions).
<===================>
import Gnuplot
x=range(0,100,1)
y=range(3,503,5)
case=1
w=Gnuplot.Gnuplot()
for iter in range(1000):
print iter
if case==1:
d1=Gnuplot.Data(x,y)
else:
f1='/tmp/file123'
f1h=open(f1,'w')
for v1,v2 in zip(x,y):
f1h.write('%s %s\n' % (v1,v2))
f1h.close()
d1=Gnuplot.File(f1)
raw_input()
<=====================>
When case=1, a large amount of memory is consumed (check ps or top) I
get about 20meg and it depends on the number of iterations. When
case!=1, the memory usage is quite small, less than 4meg and is
independent of iterations.
Obviously, the problem appears to be in the Gnuplot.Data() function,
but I have not been able to track it down. It does not appear to be
related to the data passing type (fifo, inline, or temp files)
Andrew
|