|
From: Sarah M. <mou...@gm...> - 2006-03-07 22:11:03
|
On 07/03/06, John Hunter <jdh...@ac...> wrote: > >>>>> "Sarah" =3D=3D Sarah Mount <mou...@gm...> writes: > > Sarah> Hi all, is there some way to clean up all the memory used > Sarah> by matplotlib? I currently have a script which creates a > Sarah> bunch of plots and it seems to use an increasing amount of > Sarah> memory until my m/c runs out of memory and swap space. I'm > Sarah> forcing the gc to collect after every plot is generated > Sarah> (and saved to disc) and that doesn't help. Looking through > Sarah> the list of types that the gc is holding it seems like the > Sarah> vast majority of them are objects generated by > Sarah> matplotlib. I'm pretty sure now that it's not an issue with > Sarah> the data structures I'm creating, so ... any ideas? > > Are you using pylab? If so, most likely you are creating but not > closing figures. You need to pair every use of pylab figure with a > pylab close. Feel free to post an example script. 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. Thanks for such a speedy response! Sarah -- http://www.mis.coventry.ac.uk/research/imd/ http://varspool.blogspot.com |