[NumPy-Tickets] [NumPy] #2179: Memmap children retain _mmap reference in all cases

NumPy Trac numpy-tickets@scipy....
Mon Jul 2 16:44:22 CDT 2012

#2179: Memmap children retain _mmap reference in all cases
 Reporter:  sveinugu    |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  high        |   Milestone:  1.7.0   
Component:  numpy.core  |     Version:  devel   
 Keywords:              |  
 Consider the following:

 >>> a = np.memmap('file', dtype='int32')
 >>> (a + 10)._mmap is a._mmap
 # fancy indexing (doesn't return a view!)
 >>> a[[1, 2, 3]]._mmap is a._mmap
 >>> a.sum()._mmap is a._mmap

 Ideally one should be returning other ndarray objects, e.g. numpy scalars
 in the case of sum(), but this requires a larger rewrite. At least numpy
 version 1.5.1rc1 did this. The only time the _mmap should be kept (as I am
 aware of) is when slicing.

 One major problem with this the inability to garbage collect the _mmap
 when a result of some operation is stored.

 I propose a patch to temporarily fix the situation.

 See also the following thread:


Ticket URL: <http://projects.scipy.org/numpy/ticket/2179>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list