[Pyrex] Some pyrex mem problems.

Lenard Lindstrom len-l at telus.net
Fri Oct 27 21:56:06 UTC 2006


On 26 Oct 2006 at 9:50, Pere Urbón Bayes wrote:

> Hello to every body. My name is Pere (a really newby with python and 
> pyrex ;> ) and I'm trying to build a extension module with pyrex, but I 
> found some problems. When I run the test that I attach into this mail 
> I'll get this error:
> 
> -- *** glibc detected *** double free or corruption (!prev): 0x081567a0 ***
> 
> And this errors is going to make me fool, because i can not find the 
> problem. This test is working with a shared lib (I'll attach the related 
> source files, only those ones related with large_kernel function). The 
> first thing that i did was try to debug with valgrind the shared lib, 
> but this was ok and without any memory related problems.
> 
I can find nothing in ubc.pxy that would cause a memory error. The 
import statement is the only place that would involve the Python 
garbage collector. The rest is C code and works as expected. The 
external declarations in ubc.pxi are good. The C compiler would warn 
if something was wrong.

A note about external structure declarations in Pyrex. Only those 
structure fields that will be used in Pyrex code need be declared. 
For instance, since FILE is only used in pointer declarations the 
following incomplete declaration will work:

cdef extern from "stdio.h":
    ctypedef struct FILE:
        pass

Lenard Lindstrom
<len-l at telus.net>





More information about the Pyrex mailing list