I believe it will because there will be no pointer to each allocated string 
after a new one is allocated. Note that it won't be deallocated immediately. It 
will be deallocated when the collector runs.



----- Original Message ----
From: Michael Abendroth <[email protected]>
To: [email protected]
Sent: Sun, January 3, 2010 9:59:01 AM
Subject: Question about garbage collection

Hi all,

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.
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/oftenwrongsoong%40yahoo.com

This email sent to [email protected]



      
_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to