Segmentation Fault on exit

V

Vipul Raheja

Hi,

I have wrapped a library from C++ to Python using SWIG. But when I
import it in Python, I am able to work fine with it, but it gives a
segmentation fault while exiting. Following is the log:

vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.Segmentation fault
vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$

Kindly help.

Thanks and Regards,
Vipul Raheja
 
U

Ulrich Eckhardt

Vipul said:
I have wrapped a library from C++ to Python using SWIG. But when I
import it in Python, I am able to work fine with it, but it gives a
segmentation fault while exiting.

1. Use a debugger
Run python with "gdb python", import the module and exit. The debugger
should then show you where the segmentation fault occurs, even though that
code isn't necessarily the code that is at fault itself.

2. Reduce the size of your module
Remove code from the module. The most drastic variant is to strip anything
and only leave an empty init function. If that still causes troubles, I'd
suspect something in the environment or in the way you build the module.

3. Make sure the environment works
Try compiling and running the SWIG examples or any other SWIG code. Does it
work? What are the differences to your code?

4. Post your code
If everything fails, you could try to reduce your module to the bare minimum
and post that here. Make sure you really remove anything that's not
necessary.


Uli
 
R

ron

Hi,

I have wrapped a library from C++ to Python using SWIG. But when I
import it in Python, I am able to work fine with it, but it gives a
segmentation fault while exiting. Following is the log:

vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.>>>import pyossim

* Do some stuff *
Segmentation fault
vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$

Kindly help.

Thanks and Regards,
Vipul Raheja

Check out Valgrind. It's easy to set up, runs like gdb, but keeps
track and flags any offending memory use at the c level. Then just
need to find the calling python code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top