[Numpy-discussion] [matplotlib-devel] matplotlib is breaking numpy

Michael Droettboom mdroe@stsci....
Thu Nov 19 14:25:35 CST 2009

Yes, for efficiency reasons matplotlib will use a reference to original 
data whenever possible, rather than copying it.  Also, when using the 
pylab/pyplot API, matplotlib figures also stay around until they are 
explicitly deleted.  You may need an explicit call to "clf('all')" to 
remove the figures, and thus references to the memmap'd file.

However, my advice would be to just not use memmap.  I can't imagine 
matplotlib performs very well if the data can't all fit in memory, so 
you might as well just load it all into memory anyway.


Mathew Yeates wrote:
> There is definitely something wrong with matplotlib/numpy. Consider 
> the following
> >from numpy import *
> >mydata=memmap('map.dat',dtype=float64,mode='w+',shape=56566500)
> > del mydata
> I can now remove the file map.dat with (from the command line) $rm map.dat
> However
> If I plot  mydata before the line
> > del mydata
> I can't get rid of the file until I exit python!!
> Does matplotlib keep a reference to the data? How can I remove this 
> reference?
> Mathew
> ------------------------------------------------------------------------
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> ------------------------------------------------------------------------
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

More information about the NumPy-Discussion mailing list