prevent memory leak in C+Python

Uwe Mayer merkosh at hadiko.de
Mon Mar 20 17:24:28 EST 2006


Hi,

I am wrapping a C function returning large amount of binary data back to
Python using SWIG. 

I have the data malloc()ed or new()ed on the heap and buffer objects seem a
good way to wrap it in python
(http://docs.python.org/api/bufferObjects.html)

>From the documentation it seems PyBuffer_FromReadWriteObject() will not
release the allocated shared memory. How do I prevent a memory leak in this
case?

Thanks,
Ciao
Uwe
-- 
Everything you read in newspapers is absolutely true, except for that
rare story of which you happen to have first-hand knowledge.
                -- Erwin Knoll




More information about the Python-list mailing list