• 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: Accessor methods and (auto)release <Memory trail>
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessor methods and (auto)release <Memory trail>


  • Subject: Re: Accessor methods and (auto)release <Memory trail>
  • From: Brant Vasilieff <email@hidden>
  • Date: Wed, 31 Jul 2002 14:34:12 -0700

On Wednesday, July 31, 2002, at 10:34 AM, cocoa-dev-
email@hidden wrote:

I am concerned about the more subtle case such as:

str = [myWindow title];
...
[myDocument saveDocument];
...
... use str ...

Assuming myDocument is the document in myWindow, a side effect of the
"saveDocument" call might be to release the title you got back in the
first line. A retain/autoreleased return from the first line would
eliminate this potential issue, which could be hard to debug.

Thanks for the clearer example.

I was curious about the difference between returning [[title retain] autorelease] and [[title copy] autorelease].

Does the compiler provide special treatment for retain as a keyword, treating it as an inline macro?
Also, are the retain, release and autorelease messages atomic?

Cheers,
Brant
_______________________________________________
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.

  • Prev by Date: how do i read and send data through a serial port (using a keyspan adaptor)
  • Next by Date: Re: how do i read and send data through a serial port (using a keyspan adaptor)
  • Previous by thread: Re: Accessor methods and (auto)release <Memory trail>
  • Next by thread: Help with saving settings in an application made with ASStudio
  • Index(es):
    • Date
    • Thread