[Openmcl-devel] memory management and OpenGL trouble

Alexander Repenning ralex at cs.colorado.edu
Thu Sep 16 18:59:29 PDT 2010

With the latest version of CCL x86 32/64, 1.6-dev-r14265M-trunk  (DarwinX8664) all of our OpenGL code crashes. The same source works fine in 1.6-dev-r14231M-trunk and all versions before. I have not tested versions in between. It is as if some memory management changed. Is the cocoa bridge more aggressive in getting rid of non-retained objective-C objects?

When creating a window with an opengl view the crash looks like this:

Thread 4 Crashed:
0   GLEngine                      	0x0000000017b3adfa gliAttachDrawableWithOptions + 44
1   com.apple.opengl              	0x00007fff82843f64 CGLClearDrawable + 186
2   com.apple.AppKit              	0x00007fff886d8c30 -[NSOpenGLContext clearDrawable] + 82
3   com.apple.AppKit              	0x00007fff886d90d5 -[NSOpenGLContext dealloc] + 204
4   com.apple.AppKit              	0x00007fff885671b7 -[NSOpenGLContext initWithFormat:shareContext:] + 215
5   com.clozure.Clozure CL-x8664  	0x000000000001b38b SPffcall + 99 (x86-spentry64.s:4043)
6   ???                           	0x0000000017a18fd0 0 + 396464080

The dealloc makes no sense and cannot be traced back to the Lisp code:

        (when View-to-Share
            (let ((glContext
                    (#/openGLContext Native-Control)
                    Pixel-Format ;; redundant but should be OK
                    (#/openGLContext (native-view View-to-Share)))))
              (unless glContext (error "cannot share OpenGLContext of view ~A" View-to-Share)))))
        (#/release Pixel-Format)

Wrapping up the (#/initWithFormat:shareContext: with a (#/retain will postpone this crash but not for long 

Thread 4 Crashed:
0   libobjc.A.dylib               	0x00007fff80a5e11c objc_msgSend + 40
1   com.apple.AppKit              	0x00007fff886e4a73 -[NSOpenGLView _invalidateGStatesForTree] + 137
2   com.apple.AppKit              	0x00007fff884d6c98 -[NSView _invalidateFocus] + 24
3   com.apple.AppKit              	0x00007fff884d1682 -[NSView setFrameSize:] + 370
4   com.clozure.Clozure CL-x8664  	0x000000000001b38b SPffcall + 99 (x86-spentry64.s:4043)
5   ???                           	0x0000000017888148 0 + 394821960
6   ???                           	0x00000000178881b8 0 + 394822072

This code goes back to about CCL 1.2 and worked fine for a long time. Any suggestions on what changed relatively recently that could cause this kind of behavior? Also, the crash is for 32 and 64 bit


Prof. Alexander Repenning

University of Colorado
Computer Science Department
Boulder, CO 80309-430

vCard: http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20100916/f4483b3f/attachment.htm>

More information about the Openmcl-devel mailing list