[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about object initialization and autorelease

From: Omar Campos
Subject: Re: Question about object initialization and autorelease
Date: Sat, 31 Mar 2012 17:09:40 -0430

Hi all,

 Thanks for your replies.

I understand better about the AUTORELEASE macro now. I was using it instead of -autorelease, since I saw this is how it is done in the tutorials. I figured it must simply be done this way in GNUstep.  And you're right, AUTORELEASE() does not init the object (maybe that's why I was getting Illegal operation messages?).

> Also, coming from a iOS background,

If you come from iOS, is there a reason you choose not to use ARC?

What exactly is ARC? I haven't heard the term before.

>The correct time to send an -autorelease message is when you want a non-owning reference that is guaranteed to persist for the >duration of scope of a local variable and you have a religious of philosophical aversion to ARC.

I did not understand this part. What exactly is a non-owning reference? In fact, why bother using -autorelease at all? Doesn't the framework automatically create an autorelease pool when NSApplicationMain() is called?

Sorry if I am sound like a total newbie ('cause I actually am!). As I said, my Obj-C experience is with the iOS frameworks, particularly Cocoa Touch. And, in my year and two months experience, I haven't had the need to use -autorelease (or maybe there was, and my apps are leaking memory!).

Thanks again for your answers.  You guys are one of the best online communities I've ever participated in.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]