• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question about garbage collection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about garbage collection


  • Subject: Re: Question about garbage collection
  • From: Oftenwrong Soong <email@hidden>
  • Date: Mon, 11 Jan 2010 12:40:49 -0800 (PST)

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@hidden>
To: email@hidden
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@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




_______________________________________________

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

References: 
 >Question about garbage collection (From: Michael Abendroth <email@hidden>)

  • Prev by Date: Re: Open new document from within another document.
  • Next by Date: Re: Core Data Document based app need some help
  • Previous by thread: Re: Question about garbage collection
  • Next by thread: Setting NSWindow titlebar height
  • Index(es):
    • Date
    • Thread