[pypy-dev] cffi dlopen

Armin Rigo arigo at tunes.org
Tue Sep 22 11:05:14 CEST 2015


Hi Roshan,

On Mon, Sep 21, 2015 at 9:58 PM, Roshan Cherian <cherian.rosh at gmail.com> wrote:
> I do have a question on memory management, currently I am using lib.
> Currently lib provides me with icalcomponent_free which I pass in as the
> function to be used in __del__. Should I be using this or should I be using
> something specific from the python extension? This is what I see in the
> python extension which was created.
>
> static void _cffi_d_icalcomponent_free(icalcomponent * x0)
> (...)

This is the code in C that implements the function
"lib.icalcomponent_free()".  There are similar pieces of code for all
other functions.  What are you asking specifically?  If it's ok to
call such functions from a __del__()?  Yes, it is.

Sometimes you can use ffi.gc() instead and give the function
"lib.icalcomponent_free" directly as a second argument; then you don't
need a __del__.  But if the __del__ solution suits your case, then
that's fine.


A bientôt,

Armin.


More information about the pypy-dev mailing list