segfault in extension module

From: Nathaniel Echols (echols_at_OCF.Berkeley.EDU)
Date: 12/01/03


Date: Sun, 30 Nov 2003 16:19:45 -0800


I've written a function in C to perform protein sequence alignment. This
works fine in a standalone C program. I've added the necessary packaging
to use it in Python; it returns three strings and an integer. However, as
soon as the function is complete, I get a segfault and the interpreter
dies.

If I run Python interactively, just calling the function causes a
segfault. If I'm running a script, I can actually print out the return
values (which are what I'd expect - so something's working) but as soon as
the script is done I get the segfault again. I can even call the function
twice, with different arguments - and it works both times. So it appears
that the problem is with tying up loose ends.

How do I determine what is going wrong? I do not get any problem like
this in the C version. I am not using free() anywhere - I will eventually
need to fix this, but I cannot find any place where I might be accessing
unavailable memory. (Adding in free() does not make any difference in the
module, for what it's worth, but I've had some issues with the C program
so I've left it out.)

[I've also tried using PyMem_Malloc instead, throughout the C code.
Doesn't help.]

thanks,
Nat
(please reply directly!)



Relevant Pages

  • Re: wpa_supplicant segfaults with ath
    ... is an easy bit of script I can impliment in order to have the wpa_supplicant ... >A stack trace at the time of the segfault would be useful. ... >mismatches should not be an issue unless there are alignment problems. ...
    (freebsd-current)
  • Re: [SLE] thunderbird disappears in the middle of an email
    ... No segfault, ... I can restart it and start my email over. ... non-trivial cover script for launching. ... diagnostic output could be mediated and / or redirected ...
    (SuSE)