[Pythonmac-SIG] Quartz, twisted.web and CGBitmapContextCreate

Ronald Oussoren ronaldoussoren at mac.com
Wed Nov 25 16:43:46 CET 2009


 
On Monday, November 23, 2009, at 04:08PM, "Erik van Blokland" <erik at letterror.com> wrote:
>Hi all,
>
>I'm hesitant to write this mail, but after a day of fruitless debugging, I need a reality check. OSX 10.6.2, stock Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51).
>
>At the center is a python object intended to generate a bitmap image. It uses CGBitmapContextCreate to make a new context, does some drawing and returns the image. All drawing, rendering works, all tests pass when running the script as a one-off test.
>But when I use the same object as part of a twisted.web internet.TCPServer, I get a hard crash when calling CGBitmapContextCreate, (report attached below). The twisted.web process itself runs well, I can access its pages and all (html) data is rendered properly. Only when I ask for the image the process pops the lid and is killed.
>
>According to 
>	http://developer.apple.com/mac/library/DOCUMENTATION/GraphicsImaging/Reference/CGBitmapContext/Reference/reference.html
>CGBitmapContextCreate  asks for a chunk of memory where it can draw. When testing offline, passing None works, numpy and array.arrays also work. But none of the options prevent crashing in the online version.
>
>I can't see what goes on inside CGBitmapContextCreate and I don't have experience reading these crash reports. Looks like a memory thing no? Any pointers would be very welcome.

Crash reports tend to be pretty useless to find out what's really going on, especially with memory management issue.

Do you have a simple example that shows of the bug? I really need that to debug when the issue does not occur in a basic command-line script.

Ronald



More information about the Pythonmac-SIG mailing list