Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10969 > unrolled thread

Segmentation Fault on exit

Started byVipul Raheja <vipul.iiith@gmail.com>
First post2011-08-06 16:05 +0530
Last post2011-08-10 07:18 -0700
Articles 3 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Segmentation Fault on exit Vipul Raheja <vipul.iiith@gmail.com> - 2011-08-06 16:05 +0530
    Re: Segmentation Fault on exit Ulrich Eckhardt <ulrich.eckhardt@dominolaser.com> - 2011-08-08 08:56 +0200
    Re: Segmentation Fault on exit ron <vacorama@gmail.com> - 2011-08-10 07:18 -0700

#10969 — Segmentation Fault on exit

FromVipul Raheja <vipul.iiith@gmail.com>
Date2011-08-06 16:05 +0530
SubjectSegmentation Fault on exit
Message-ID<mailman.1971.1312626956.1164.python-list@python.org>
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 *
>>> exit()
Segmentation fault
vipul@vipul-laptop:~/ossim-svn/src/pyossim/swig$

Kindly help.

Thanks and Regards,
Vipul Raheja

[toc] | [next] | [standalone]


#11029

FromUlrich Eckhardt <ulrich.eckhardt@dominolaser.com>
Date2011-08-08 08:56 +0200
Message-ID<1ed4h8-eo4.ln1@satorlaser.homedns.org>
In reply to#10969
Vipul Raheja wrote:
> 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

-- 
Domino Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932

[toc] | [prev] | [next] | [standalone]


#11123

Fromron <vacorama@gmail.com>
Date2011-08-10 07:18 -0700
Message-ID<38f2d76e-057f-4d62-9012-e09c18639de9@t7g2000vbv.googlegroups.com>
In reply to#10969
On Aug 6, 6:35 am, Vipul Raheja <vipul.ii...@gmail.com> wrote:
> 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 *
> >>> exit()
>
> 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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web