howto return malloc()ed memory from C -> Python
Hi, I am wrapping libsndfile to Python, using SWIG and don't know howto return a malloc()ed memory area back to Python. I've found CObjects, which would let me pass free() as cleanup function, but I'd rather return a buffer object (PyBuffer_FromReadWriteMemory) so that I could prevent copying of data, but I don't know how to prevent the memory leak then. Can I install some kind of cleanup hook? Please also reply to me personally, as I am not on the python-dev list. Thanks, Uwe -- Conway's Law: In any organization there will always be one person who knows what is going on. This person must be fired.
On Wed, Mar 22, 2006, Uwe Mayer wrote:
I am wrapping libsndfile to Python, using SWIG and don't know howto return a malloc()ed memory area back to Python.
Please post this question to comp.lang.python; it's not appropriate for python-dev. Note that you're unlikely to get many useful responses if you don't subscribe to c.l.py. -- Aahz (aahz@pythoncraft.com) <*> http://www.pythoncraft.com/ "Look, it's your affair if you want to play with five people, but don't go calling it doubles." --John Cleese anticipates Usenet
participants (2)
-
Aahz
-
Uwe Mayer