[NumPy-Tickets] [NumPy] #2253: numpy.diag leak

NumPy Trac numpy-tickets@scipy....
Mon Nov 26 13:03:08 CST 2012


#2253: numpy.diag leak
---------------------------------+------------------------------------------
 Reporter:  maxarai@…            |       Owner:  somebody   
     Type:  defect               |      Status:  new        
 Priority:  normal               |   Milestone:  Unscheduled
Component:  numpy.core           |     Version:  devel      
 Keywords:  memory leak          |  
---------------------------------+------------------------------------------
 numpy.diag increments the reference count, and can thereby create leaks

 import numpy as np
 import sys

 bigArray = np.random.rand(1000,1000)
 rc0 = sys.getrefcount(bigArray)
 sampleDiagonal = np.diag(bigArray)
 rc1 = sys.getrefcount(bigArray)
 print 'Reference count should not have incremented from {0} to
 {1}'.format(rc0, rc1)

 My platform is Mac OSX 10.8.2, Python 2.7, numpy 1.80 devel

 bash-3.2$ python
 Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
 Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy as np
 >>> np.__file__
 '/Library/Python/2.7/site-
 packages/numpy-1.8.0.dev_9597b1f_20120920-py2.7-macosx-10.8-x86_64.egg/numpy/__init__.pyc'

 Any suggestions for a workaround or patch would be welcomed.
 Thanks for looking.

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


More information about the NumPy-Tickets mailing list