[python-list] Re: Strange crash issue on Windows w/ PyGTK, Cairo...

CJ Kucera pez at apocalyptech.com
Thu Mar 19 07:04:35 CET 2009

bieffe62 at gmail.com wrote:
> If you have worked with C/C++, you know that memory-related bugs can
> be very tricky.
> More than once - working with C code - I had crashes that disappeared
> if I just added
> a 'printf', because the memory allocation scheme changed and the
> memory corrupted was not anymore
> relevant.

Well, you turned out to be dead right about this, as I suppose should
have been pretty obvious given the nature of the problems I was having.

Anyway, the issue turned out to be zlib.decompress() - for larger sets
of data, if I wasn't specifying "bufsize," the malloc()s that it was
doing behind-the-scenes must have been clobbering memory.  As soon as I
specified bufsize, everything was totally kosher.

Once I'm a bit more awake tomorrow I'll put together a testcase and send
it in to the bug tracker.

This does bring up one question: for larger chunks of data, is it More
Appropriate to use a zlib decompression object instead of just passing
it all through zlib.decompress()?

Thanks, everyone...


More information about the Python-list mailing list