Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.