[Scipy-tickets] [SciPy] #1267: Sparse matrix operations crash python interpreter

SciPy Trac scipy-tickets@scipy....
Wed Aug 18 01:11:33 CDT 2010


#1267: Sparse matrix operations crash python interpreter
--------------------+-------------------------------------------------------
 Reporter:  lutz    |       Owner:  somebody
     Type:  defect  |      Status:  new     
 Priority:  normal  |   Milestone:  0.9.0   
Component:  Other   |     Version:  0.7.0   
 Keywords:          |  
--------------------+-------------------------------------------------------
 The following code snippet consistently crashes the python interpreter,
 using python 2.6.5, SciPy 0.7.2 or 0.8.0, on OS-X (32 or 64 bit):

 {{{
 import numpy as np
 import scipy.sparse

 content = np.load("test.npz")
 C = scipy.sparse.csr_matrix((content["data"], content["indices"],
 content["indptr"]), shape=content["shape"])
 indices = np.array(C.nonzero()).transpose()
 for ind in indices:
     C[ind[0],ind[1]] /= 2
 }}}

 The file test.npz contains a sparse matrix of medium size (10000x10000),
 with about 300000 non-zero elements. The file is attached.

 The code does not fail during execution, but upon exiting the python
 interpreter. Presumably something goes wrong when the memory for the
 sparse matrix object is deallocated. The backtrace looks like this:

 {{{
 #0  0x0000000100503644 in array_dealloc ()
 #1  0x00000001005036eb in array_dealloc ()
 #2  0x00000001005036eb in array_dealloc ()
 #3  0x00000001005036eb in array_dealloc ()
 #4  0x00000001005036eb in array_dealloc ()

 [ ... many more times the exact same line ... ]

 #261938 0x00000001005036eb in array_dealloc ()
 #261939 0x00000001005036eb in array_dealloc ()
 #261940 0x00000001005036eb in array_dealloc ()
 #261941 0x00000001005036eb in array_dealloc ()
 #261942 0x000000010004f97b in dict_dealloc ()
 #261943 0x000000010006cfa5 in subtype_dealloc ()
 #261944 0x000000010004e647 in insertdict ()
 #261945 0x0000000100050bd2 in PyDict_SetItem ()
 #261946 0x0000000100052dad in _PyModule_Clear ()
 #261947 0x00000001000ce66d in PyImport_Cleanup ()
 #261948 0x00000001000de4a8 in Py_Finalize ()
 #261949 0x00000001000ee097 in Py_Main ()
 #261950 0x0000000100000f14 in ?? ()
 }}}

-- 
Ticket URL: <http://projects.scipy.org/scipy/ticket/1267>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list