prevent memory leak in C+Python

U

Uwe Mayer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,291
Messages
2,571,455
Members
48,131
Latest member
AntoniaSep

Latest Threads

Top