[Numpy-discussion] double free or corruption after calling a Slicot routine wrapped with f2py

enrico avventi eavventi at yahoo.it
Tue Feb 23 11:32:44 EST 2010


hello,

first of all, as i'm new here, i would like to greet everyone in the list and thank the developers of numpy/scipy. i'm transitioning my work from matlab to python and this software is very helpfull indeed.

the reason i'm writing is that i got to a stumbling block last week. i tried wrote some wrappers of Slicot routines aided by f2py that i keep on github (http://github.com/avventi/Slycot).
the latest routine i tried to wrap, SB02OD, make python to crash with the glibc error double free or corruption. precisely i get this error if the wrapper slycot.sb02od is called within a method, i.e

Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import slycot
>>> slycot.examples.sb02od_example()
--- Example for sb01od ...
The solution X is
[[ 1.  0.]
 [ 0.  2.]]
rcond = 0.632455532034
*** glibc detected *** python: double free or corruption (!prev): 0x082ec3b8 ***

as you can see the routine does indeed return the correct output but make python crash afterwards. On the other hand if i type ieach step interactively

Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14) 
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> import slycot
>>> A = array([[0,1],[0,0]])
>>> B = array([[0],[1]])
>>> C = array([[1,0],[0,1],[0,0]])
>>> Q = dot(C.T,C)
>>> R = zeros((1,1))
>>> L = zeros((2,1))
>>> out = slycot.sb02od('D',2,1,3,A,B,Q,R,L)
>>> out[1]
array([[ 1.,  0.],
       [ 0.,  2.]])
>>> out[0]
0.63245553203367577
>>> out = slycot.sb02od('D',2,1,3,A,B,Q,R,L)
*** glibc detected *** python: double free or corruption (!prev): 0x0832b428 ***

it works the first time but not the second. i tried Debian lenny 32/64bit and a virtualized Fedora 12 32bit and the error persists.

do you have any ideas why this happens or where should i look to start solving it?

thanks in advance.
regards,

/Enrico
 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100223/3938eab7/attachment.html>


More information about the NumPy-Discussion mailing list