views:

63

answers:

1

If garbage collection is not required:

- (void) awakeFromNib{

//Create the NSStatusBar and set its length
statusItem = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
...

Do I have to release that? And if I do, would that be in a finalize method or dealloc method?

If garbage collection is required, then is the retain call above ignored automatically?

+2  A: 

Yes, since you have retained the object you must release it. The place where you would release it is the dealloc method. And yes, when garbage collection is enabled it ignores all retain/release calls. Read the memory management rules here for more information.

macatomy