[Openmcl-devel] Scribble demo

Raffael Cavallaro raffaelcavallaro at mac.com
Wed Jun 3 08:26:30 PDT 2009


On Jun 3, 2009, at 2:41 AM, Ron Garret wrote:

>  It's still rough, probably leaks a lot of memory, but it works.

Your biggest memory leak is probably:

(#/setReleasedWhenClosed: nsw nil)

If you comment this out each new scribble-window will not leak memory  
since the default for NSWindow is releasedWhenClosed. Both in testing  
and looking at your event handling code, there is nothing that the  
Cocoa event handling system will call on your window once it gets a  
performClose (i.e., you don't have some other thread or input that is  
sending messages to your window which needs to be notified to stop  
doing so in a delegate's windowShouldClose: method). I've removed it  
and created and closed several hundred scribble-windows without  
leaking memory. If you keep it as is, you leak about 350k per scribble  
window (at least according to Activity Monitor's RSIZE figure).

warmest regards,

Ralph




Raffael Cavallaro
raffaelcavallaro at me.com








More information about the Openmcl-devel mailing list