File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes iOS and the fly likes Retain Vs. Copy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Mobile » iOS
Bookmark "Retain Vs. Copy" Watch "Retain Vs. Copy" New topic
Author

Retain Vs. Copy

Anil Giri
Greenhorn

Joined: Jun 04, 2009
Posts: 9
I am wondering what should we be using, retain or copy with class members? Is copy operation heavier than retain?


SillyCon!
Pratik Goswami
Ranch Hand

Joined: Mar 02, 2009
Posts: 136

Hi Anil,

Anil Giri wrote:I am wondering what should we be using, retain or copy with class members? Is copy operation heavier than retain?

Copy is used generally for NSString. If the string is Mutable then it will be copied else it will be retained. Copy is a Call-By-Reference whereas Retain is Call-By-Value.
For both the case object's retain count will be increment by 1.

Thanks
Pratik Goswami


iOS * Android Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retain Vs. Copy