| Sign In/My Account | View Cart |
| Article: |
Memory Management in Objective-C | |
| Subject: | Really good treatment | |
| Date: | 2001-07-28 19:50:32 | |
| From: | chaoswerks | |
|
Response to: Really good treatment
|
||
| Here's a simple guide for retain or copy. Use retain when the object represents a relationship. Use copy when the object represents a value. The difference is this: in a relationship, if the object pointed to changes, you want your variable to reflect this change of state; whereas, with a value, you want the value to remain unaltered if the original object changes unless you explicitly alter your copy. | ||