[NumPy-Tickets] [NumPy] #2198: np.loadtxt leaks memory

NumPy Trac numpy-tickets@scipy....
Thu Aug 9 04:12:30 CDT 2012


#2198: np.loadtxt leaks memory
---------------------------------+------------------------------------------
 Reporter:  tanriol              |       Owner:  somebody   
     Type:  defect               |      Status:  new        
 Priority:  normal               |   Milestone:  Unscheduled
Component:  numpy.lib            |     Version:  1.6.1      
 Keywords:  loadtxt memory leak  |  
---------------------------------+------------------------------------------
 The amount of memory leaked far exceeds the amount the loaded data takes
 and does not go away when the loaded array is deleted.
 {{{
 >>> import numpy as np
 >>> # Python consuming 13M RAM
 >>> arr = np.zeros((10000, 5000), dtype='<i8')
 >>> # Python consuming 394M RAM
 >>> np.savetxt('array.txt', arr, '%d')
 >>> # Python consuming 395M RAM
 >>> del arr
 >>> # Python consuming 14M RAM
 >>> arr = np.loadtxt('array.txt', dtype='<i8')
 >>> # Python consuming 2245M(!)
 >>> del arr
 >>> # Python consuming 1863M(!)
 >>> import gc
 >>> gc.collect()
 6
 >>> # Python consuming 1863M(!)
 }}}
 CPython 2.7.3, Numpy 1.6.2

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


More information about the NumPy-Tickets mailing list