Glibc detected *** python: double free or corrupt (! Prev) SWIG

After writing a wrapper in SWIG for my C ++ algorithms, I constantly get this error when I exit the Python interpreter after importing a 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 need Ctrl + C to regain control ... what happens?

I run the following commands to create 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 algol.hpp link:

%module algol
%{
#include "algol.hpp"
%}
%include "algol.hpp"

What do you think of this ?: S

Edit: here is a sample source code -> http://pastebin.com/q210vEAs

+5
source share
1 answer

what's happening?

Exactly what the message says: either some code did double or some other damage to the heap.

awoodland, python Valgrind , .

+1

All Articles