Hi all, I'm hoping that this will be an easy question.

I have a pile of C code that I wrote that I want to interface to via the ctypes 
module (https://docs.python.org/3/library/ctypes.html).  The C code uses the 
Boehm-Demers-Weiser garbage collector (http://www.hboehm.info/gc/) for all of 
its memory management.  What I want to know is, who owns allocated memory?  
That is, if my C code allocates memory via GC_MALLOC() (the standard call for 
allocating memory in the garbage collector), and I access some object via 
ctypes in python, will the python garbage collector assume that it owns it and 
attempt to dispose of it when it goes out of scope?

Ideally, the memory is owned by the side that created it, with the other side 
simply referencing it, but I want to be sure before I invest a lot of time 
interfacing the two sides together.

Thanks,
Cem Karan
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to