Re: [Newbie Q] Memory Management in Cocoa
Re: [Newbie Q] Memory Management in Cocoa
- Subject: Re: [Newbie Q] Memory Management in Cocoa
- From: Timothy Ritchey <email@hidden>
- Date: Tue, 5 Nov 2002 13:45:24 -0500
In general, objects returned by class factory functions are placed in
the autorelease pool. At the end of the current event cycle, they will
automatically be released. If you want to hold onto them for longer
than the scope of your method, you must retain. Once you have retained,
the normal release requirement prevails.
- tim
On Tuesday, November 5, 2002, at 01:22 PM, Flemming Bengtsson wrote:
Hi All,
I'm getting a little bit confused about when to dealloc an instance.
It's obvious that instances created like [[foo alloc] init ]; should be
deallocated when done with.
But what about instances created like:
NSString * aNSString = [NSString stringWithCString:"Hello" length:5];
Regards
Flemming Bengtsson, FLB Software-udvikling
http://www.flbsoftwareudvikling.dk/
iChat/AOL: email@hidden
Phone: +45 24 82 24 25
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.