But if you can get a standalone script, that would be most

    > efficient.

    > I sent it direct to you, rather than everyone on the list.

OK, the good news is that my first hunch was correct. The fact that
the minimal script (off-list) needed more iterations than the full,
and that the number of iterations on my system before the crash was
different than yours indicated to me that it was a memory problem.
matplotlib uses a fair number of cyclic references (figure refers to
canvas and canvas refers to figure -- this one was actually added in
0.72 which is where I suspect the culprit is).

In the pylab interface, I call gc.collect in the destroy method of
each figure manager to force the garbage collector to clean up. In
your script, which doesn't use the pylab interface, you need to
manually add this call yourself. I'll make it a FAQ because it is
fairly important, and add a link or the faq in the agg_oo example.

import gc

    def graphAll(self):
        for i in range(100):
            print i

Should cure what ails you!

python gurus -- would it be advisable for me to insert a gc.collect()
somewhere in the matplotlib OO hierarchy since I know cyclic
references are a problem? Eg in the call to the FigureCanvas init


John Hunter wrote:


Should cure what ails you!

The good news is that it is a huge improvement, but the bad news is that I'm still getting a GPF, just a lot less often :frowning: Try bumping the minimal test loop up to 5k, it failed at 3057 for me.