Ah! Well, I guess I just didn't read the doc's
> properly. pylab.close() seems to do the
> trick. Interestingly, the amount of garbage still seems to
> grow monotonically, but much, much slower and everything
> seems to be kept in memory and not swap.
Or perhaps the docs just weren't explicit enough!
I added the following to the pylab.figure docstring:
If you are creating many figures, make sure you explicitly call "close"
on the figures you are not using, because this will enable pylab
to properly clean up the memory.