Re: Question about garbage collection
Re: Question about garbage collection
- Subject: Re: Question about garbage collection
- From: Bill Bumgarner <email@hidden>
- Date: Sun, 03 Jan 2010 17:31:27 -0800
On Jan 3, 2010, at 2:45 PM, Graham Cox wrote:
> On 04/01/2010, at 4:59 AM, Michael Abendroth wrote:
>
>> When I write something like:
>>
>> while (true) {
>> NSString *s = [[NSString alloc] initWithString:@"applejuice"];
>> }
>>
>> Will s be garbage collected? If not, how can I make sure it does get
>> deallocated by garbage collection.
>
>
> As written, it's academic, as your program will never proceed beyond this point, and will eventually crash with an out of memory error.
In Leopard, definitely.
In Snow Leopard, maybe not. It is a rather contrived test case, but it is much more difficult to outrun the collector in Snow Leopard than it was in Leopard.
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden