On Jun 30, 2009, at 7:54 PM, Tommy Grav wrote:

> That is what I was assuming, but it still seems a little odd that
> matplotlib generates
> that large of a memory footprint. Loading the fits file into the
> program using pyfits,
> with the code only uses 19MB of real memory and 600MB of virtual
> memory (strangly
> adding the line img = hdu[1].data, increases this to 208MB/800MB).
>
The reason for this is that pyfits doesn't actually load the data  
until you 'touch' the data attribute (to minimize memory, particularly  
if you just are interested in the header information).

As for the memory footprint of matplotlib, in order to be able to  
resize and handle interactive updates, it has to retain references to  
the original image, perhaps as well to intermediate products (and  
these references won't be memory collected until you clear the figure  
(e.g., clf()). It's one of the prices for flexibility and generality.  
It probably would take a lot of complexity to optimize it for large  
images (but John is better suited to answer this conclusively).

Perry


> Displaying images of various sizes I get these
> numbers from Activity Monitor
>
> Size                 Real Mem      Virtual
> 3k x 3k           0.68GB            1.57GB
> 4k x 4k               0.92GB            1.80GB
> 5k x 5k               1.20GB            2.10GB
> 5.5k x 5.5k     1.38GB            2.28GB
>
> And the limit seems to be somewhere just above 5.5k by 5.5k (darn :( )
>
> Cheers
>  Tommy
>

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to