[Numpy-discussion] Help with python in C code
Tue Feb 12 16:06:15 CST 2013
I was able to successfully embed python code into C code. The basic
skeleton is something like this :
In C code :
PyObject *pName, *pModule, *pFunc,*pArgs,*pReturn;
import_array(); // required while using numpy arrays in C
// Call some python code
// Py_Decref all the used values
Py_Finalize caused segmentation faults when numpy was one of import modules
[node1:05762] Failing at address: 0x1
[node1:05762] [ 0] /lib64/libc.so.6 [0x3afa630280]
[node1:05762] [ 1]
[node1:05762] [ 2]
[node1:05762] [ 3]
[node1:05762] [ 4] /usr/lib64/libpython2.4.so.1.0(PyObject_IsTrue+0x37)
Which could be avoided by not calling Py_Finalize. But without calling
Py_Finalize(), I am having huge memory leaks
as the process keeps on increasing its memory usage as I see in top.
Is there any clean way of calling Py_Finalize() when using numpy.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion