[Openmcl-devel] cocoa bridge memory management changes?
plkrueger at comcast.net
Fri Sep 24 21:36:02 UTC 2010
Sorry, didn't mean to question your Objective-C competence; just trying to understand and help. Have you tried actually looking at reference counts of objects at different points to see what is going on? Call (#_CFGetRetainCount <obj>) to get them. I've had to do that once and a while to find bugs.
To get a memory leak it sure seems like an extra retain is being done somewhere and presumably you are not doing one on the result of (make-instance ...). Does the immediate result of make-instance have a retain count of 2 or something?
On Sep 24, 2010, at 3:48 PM, Raffael Cavallaro wrote:
> I do retain it.
> Then, when the window is closed, I call release on it.
> If I allocate it with make-instance, it leaks.
> If I allocate it with #/dataWithContentsOfFile: it does not.
> If I allocate it with (#/initWithContentsOfFile: (#/alloc ns:ns-data) it does not (so using a convenience constructor has nothing to do with it - and yes, I only call retain on the autoreleased object not the alloced one).
> Since it leaks only when allocated with make-instance, I conclude that there was a bug recently introduced in make-instance for cocoa classes.
>> if you need it beyond the end of the current autorelease pool.
More information about the Openmcl-devel