carray.i and Python error?

View: New views
1 Messages — Rating Filter:   Alert me  

carray.i and Python error?

by aldous :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I've been encountering memory corruption when deleting an array created by this template:

%module example

%include "carrays.i"
%array_functions(char, charArray);

Pretty simple right?  I generate the cpp with:

swig -c++ -python test.i

And compile with:

g++ -c -fpic  test_wrap.cxx -I/usr/include/python2.6
g++ -shared test_wrap.o -o _example.so

I fire up the Python shell and:

>>> import example
>>>
>>> c = example.new_charArray(1024)
>>> example.delete_charArray(c)
*** glibc detected *** python: munmap_chunk(): invalid pointer: 0x00007f381b04ce94 ***
======= Backtrace: =========
/lib/libc.so.6[0x7f381a169cb8]
./_example.so[0x7f381961f505]
./_example.so[0x7f3819621bbe]
python(PyEval_EvalFrameEx+0x4e23)[0x4a2b03]
python(PyEval_EvalCodeEx+0x869)[0x4a4649]

This isn't good at all.  BTW I'm on this kernel, if it helps:

Linux dvenable 2.6.28-15-generic #52-Ubuntu SMP Wed Sep 9 10:48:52 UTC 2009 x86_64 GNU/Linux

I've also tried using the wrapper, which seems to be working just fine.  I can create instances of this class and when they destruct no evil occurs.
%array_class(char, byteArray);

Thoughts?

Devin




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user