[Openmcl-devel] cocoa bridge memory management changes?

Raffael Cavallaro raffaelcavallaro at mac.com
Fri Sep 24 20:35:39 UTC 2010


On Sep 24, 2010, at 4:02 PM, Willem Rein Oudshoorn wrote:

> In the foundation and appkit framework, due to historical reasons and
> maybe at one time an unfortunatel decision, the following conventions
> holds:
> 
> (#/init... (#/alloc ns:ns-...))   
> (#/new... ns:ns-...)           [ might be depracated in cocoa ] 
> 
> return objects which are retained. (which means they need 1 #/release
> message to go away)

Yes, I'm aware of the distinction between convenience methods which return autoreleased objects on the one hand, and calling copy, alloc, retain, or new on the other, which will require a corresponding release.

That's not what I'm talking about.

About a week ago, a bug was introduced in make-instance where it didn't call the correct initializer for certain objective-c classes. One possible result was a memory leak (another was a crash).

There appears to be another recently introduced bug in make-instance which doesn't lead to a crash, but does lead to a memory leak. I can tell this because when I do object allocation by (for example):

(make-instance 'ns:ns-data :with-contents-of-file ...

I get a memory leak, but if I do the same exact thing by calling:

(#/dataWithContentsOfFile: ns:ns-data ...

I don't.

warmest regards,

Ralph


Raffael Cavallaro
raffaelcavallaro at me.com








More information about the Openmcl-devel mailing list