Ctypes and freeing memory

Oliver Andrich oliver.andrich at gmail.com
Tue Oct 3 16:10:52 CEST 2006

On 10/3/06, Chris Mellon <arkanes at gmail.com> wrote:
> Not a ctypes expert but I can pretty much guaranteee that Python won't
> correctly release that memory by itself. Are you sure that description
> is actually a string object?

I also think, that Python won't release the memory, and the returned
string isn't helpful either. :)

> If it doesn't, then you can use a more literal translation of the C
> code, and use a c_void_p instead, using ctypes.string_at(description)
> to get a string out of the buffer.

This works and is a great tip! Thanks a lot.

Best regards,

Oliver Andrich <oliver.andrich at gmail.com> --- http://roughbook.de/

More information about the Python-list mailing list