[Pyrex] Just some thoughts

Tomasz Primke tprimke at interia.pl
Sun Apr 23 21:14:30 CEST 2006


> > 2) I think that Pyrex should offer some low-level memory managment
>
> > I think of sizeof operator, as well as the C standard *alloc and free
> > functions. It would be also nice to have something like the g_new macro
> > known from the GLib library.
> >
> > [snip]
>
> If you read the Pyrex doco you will find that it is preferred to use the
> python
> memory management routines when allocating memory:
>
> ctypedef long size_t
>
> cdef extern from "Python.h":
>     void* PyMem_Malloc(size_t n)
>     void PyMem_Free(void* mem)

1) I keep reading the Pyrex docs all the days (and recently also nights...), 
and I still don't know, where is this piece of information placed. But this 
docs is an another topic to discuss about.

2) One of the reasons for messing with low-level memory management is the 
execution speed of such a code. Wouldn't the speed be hurt, if the PyMem_* 
function were used instead of standard *alloc and free?


Best regards,

	Tomek



More information about the Pyrex mailing list