[4suite] cDomlette deallocation bug?

Robert Fleming fleming at cs.washington.edu
Tue Aug 22 15:06:58 MDT 2006


Greetings,

I am trying to use 4Suite inside a Python interpreter embedded in my 
application, where the Python interpreter gets Py_Initialize()'d and 
Py_Finalize()'d repeatedly.  After a few iterations of that, my 
application seg-faults.  I am using Boost.Python in the application, but 
I have been able to reproduce the problem with the small test case below:

1. copy .../4Suite-1.0b3/lib/python2.4/Ft/Xml/cDomlettec.so to a working 
directory to isolate it from Ft.*
2. test program (test.c):
/******** snip ********/
#include <Python.h>

#include <stdio.h>

int main(int argc, char* argv[])
{
  int i;
  for (i = 0; i<10; i++)
    {
      printf("%d\n", i);

      Py_Initialize();
      (void)PyRun_SimpleString("import sys\n"
                   "sys.path.append('.')\n"
                   "import cDomlettec");
      Py_Finalize();
    }

  return EXIT_SUCCESS;
}
/****** snip ********/

3. compile with:
gcc -I/usr/include/python2.4 test.c -lpython2.4

4. run program; output is:
0
1
Segmentation fault

Am I doing something wrong?  I'm pretty new to embedding Python, but I'm 
hoping to be able to cleanly load and unload 4Suite this way

I'm using Debian, with gcc 4.1.1-11 and 4Suite-1.0b3 compiled from source.

Thanks,
Robert



More information about the 4suite mailing list