On Wed, Jul 2, 2008 at 3:20 PM, laurent oget <[EMAIL PROTECTED]> wrote:
> I use the Pdf backend. I did do some digging in the GC module but have not
> found anything yet

Please keep all replies on list so others can contribute to the
discussion and future generations of googlers can benefit from it
(reply to all)

If you can provide a stand-along script that replicates the problem,
please post it.  Our canonical memory leak testing script (attached)
does not appear to be leaking in my tests with the PDF backend.
#!/usr/bin/env python

import os, sys, time, gc
import matplotlib
matplotlib.use('PDF')

from matplotlib.cbook import report_memory
import matplotlib.numerix as nx
from pylab import figure, show, close

# take a memory snapshot on indStart and compare it with indEnd

rand = nx.mlab.rand

indStart, indEnd = 200, 401
for i in range(indEnd):

    fig = figure(1)
    fig.clf()


    t1 = nx.arange(0.0, 2.0, 0.01)
    y1 = nx.sin(2*nx.pi*t1)
    y2 = rand(len(t1))
    X = rand(50,50)

    ax = fig.add_subplot(221)
    ax.plot(t1, y1, '-')
    ax.plot(t1, y2, 's')


    ax = fig.add_subplot(222)
    ax.imshow(X)

    ax = fig.add_subplot(223)
    ax.scatter(rand(50), rand(50), s=100*rand(50), c=rand(50))

    ax = fig.add_subplot(224)
    ax.pcolor(10*rand(50,50))

    fig.savefig('tmp%d' % i, dpi = 75)
    close(1)

    gc.collect()
    val = report_memory(i)
    print i, val
    if i==indStart: start = val # wait a few cycles for memory usage to stabilize

end = val
print 'Average memory consumed per loop: %1.4fk bytes\n' % ((end-start)/float(indEnd-indStart))

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to