• 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: copy and release
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copy and release


  • Subject: Re: copy and release
  • From: "David P. Henderson" <email@hidden>
  • Date: Thu, 2 Aug 2001 23:16:57 -0400

On Thursday, August 2, 2001, at 09:40 , Michael Horn wrote:

> When you copy an object. Eg,
>
> stringB = [stringA copy];
>
> Does this automatically autorelease stringB or is this just like doing
>
> stringB = [[NSString alloc] initWithString: stringA];
>
> ?
>
-copy does not return an autoreleased object. -copy returns a copy of
the object with a retain count of 1, BUT in the case of immutable
objects and -copy if the object being copied is immutable -copy will do
[stringA retain] instead of copying the object if stringA is an
immutable string. So to answer your question: No copy does not return an
autoreleased object, and Yes in most cases -copy is similiar to the
second assignment statement.

Dave
--
Chaos Assembly Werks
"Suburbia is where the developer bulldozes out the trees, then names the
streets after them."
- Bill Vaughn


References: 
 >copy and release (From: Michael Horn <email@hidden>)

  • Prev by Date: Re: Quick Question
  • Next by Date: What is a "parse error"?
  • Previous by thread: copy and release
  • Next by thread: NSOutlineView is invisible...sometimes
  • Index(es):
    • Date
    • Thread