memory violation error
careye at spamcop.net
Sat Sep 15 04:46:05 CEST 2001
Silvio Arcangeli <sarcangeli at montrouge.sema.slb.com> writes:
> So I was trying to understand if for example there could be some
> memory leak inside the function that does not cause a crash in a C
> application, but makes my Python extension crash. I don't have a deep
> knowledge of how Python allocates and deallocates memory when
> executing C functions, would it be possible?
You don't say which platform this is running on. Is it Unix or Win32,
and did you compile Python yourself?
Just to see whether it's the return or the Py_BuildValue, try putting
them on separate lines, with debugging code as well, like:
retval = Py_BuildValue("s", "Ok");
printf("Python retval: %p\n", (void *) retval);
If the Py_BuildValue fails, something has probably corrupted the heap
and a malloc() in Py_BuildValue is failing. If the return fails, the
stack has gotten corrupted instead.
Mysterious heap corruption and crashes could occur if Python itself,
the extension, and the CORBA function are not all linked to the same
shared libraries/DLLs. My probably biased view is that this is more
likely on Windows, with normal vs. debug libraries, and (different
versions of) MSVCRT vs. CRTDLL.
Carey Evans http://home.clear.net.nz/pages/c.evans/
You think you know... what's to come... what you are.
More information about the Python-list