Bug somewhere in matplotlib

There seems to be a bug somewhere in the CVS version of matplotlib or
the 2.3 version of agg that's causing me sporadic segfaults. It's
possible this isn't general and is due to some other compiled code but
doesn't seem particularly likely as the bug didn't appear when running
with a copy of matplotlib from CVS on April 14. However, I've no idea
what's causing but problem and this may be a coincidence.

I've made some attempt to track down the problem but failed (I don't
have a copy of Python installed with debugging compiled in and don't
have time to compile one). I've attached the file containing the
plotting library; the calling code references the library as utils.plot
and is:

import utils.plot, Numeric
im = Numeric.zeros((2048,1952,4), Numeric.UInt8)
p = utils.plot.plot('n', modes=(1,11), xlabel="Time (s)",
ylabel="Frequency (kHz)")
p.imshow(im/255., interpolation="nearest")

which on it's own runs fine. Running the same code in the context of my
program (inserted in the place of the real data plotting code) and it
seems to crash on it's second run. The other code loaded is f2py
wrapped Fortran which is using a fairly large amount of memory (at
minimum ~100MB and sometimes a lot more).

The reason I say seems is that if I insert print statements to check the
behaviour changes (and in fact goes away entirely sometimes); the
program never crashes on the first run. It seems fairly likely that no
one is going to have a clue what's causing this but on the off chance
someone else is having the same problem I thought I'd ask.

Thanks for any help,
Nicholas Young

plot.py (3.89 KB)