After writing up a wrapper in SWIG for my C++ algorithms i constantly get this error when I quit the Python interpreter after importing the module:
$ python
iPython 2.5.6 (r256:88840, Mar 10 2012, 14:05:15)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>from algol import *
>>>
*** glibc detected *** python: double free or corruption (!prev): 0x0000000001e42430 ***
Then I have to Ctrl+C to get back control... what is happening?
I am running the following commands to build up my SWIG wrappers:
$NAME=algol
swig -c++ -python $NAME.i
g++ -fpic -c $NAME.cpp $NAME.hpp $NAME\_wrap.cxx -I/usr/local/include/python2.5
g++ -Xlinker -zmuldefs -shared $NAME.o $NAME\_wrap.o -o _$NAME.so
My swig interface file is just an include of algol.hpp:
%module algol
%{
#include "algol.hpp"
%}
%include "algol.hpp"
What do you think about this? :S
Edit: attached sample source code here -> http://pastebin.com/q210vEAs
what is happening?
Exactly what the message says: either some code performed a double-free, or some other heap corruption.
As suggested by awoodland, run python under Valgrind, and see where that corruption or double-free is happening.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With