Skip navigation.
 
mlRe: Understanding reference count ownership
FROM : Sherm Pendley
DATE : Thu May 08 17:50:28 2008

On Thu, May 8, 2008 at 11:16 AM, Christiaan Hofman <<email_removed>>
wrote:

E.g. initWithObjects:copyItems:. I couldn't find it in the ownership
> management docs, nor in the description of the method itself.



There's no special mention in the method docs, because none is needed - the
general rules apply to this method as-is.


> In fact, that description might make you believe that the objects from the
> array are copied, and therefore should be released by you!



If the array calls -copy on the items that you've added, then *it* is
responsible for balancing that -copy, *not you* - just like always. You
didn't send the -copy message, so you are not responsible for balancing it.
The inside of another object is Las Vegas - what happens there, stays there.
Trying to balance code other than your own is what gets a lot of newbies
into deep confusion.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net

Related mailsAuthorDate
mlUnderstanding reference count ownership Gregory Seidman May 7, 23:32
mlRe: Understanding reference count ownership Christiaan Hofman May 7, 23:47
mlRe: Understanding reference count ownership j o a r May 7, 23:47
mlRe: Understanding reference count ownership Jim Correia May 7, 23:49
mlRe: Understanding reference count ownership mmalc Crawford May 8, 01:34
mlRe: Understanding reference count ownership Paul Sargent May 8, 15:16
mlRe: Understanding reference count ownership Christiaan Hofman May 8, 15:32
mlRe: Understanding reference count ownership mmalc Crawford May 8, 16:55
mlRe: Understanding reference count ownership Christiaan Hofman May 8, 17:16
mlRe: Understanding reference count ownership j o a r May 8, 17:30
mlRe: Understanding reference count ownership Sherm Pendley May 8, 17:50
mlRe: Understanding reference count ownership Christiaan Hofman May 8, 18:09
mlRe: Understanding reference count ownership Sherm Pendley May 8, 18:28
mlRe: Understanding reference count ownership Christiaan Hofman May 8, 18:48
mlRe: Understanding reference count ownership Sherm Pendley May 8, 19:16
mlRe: Understanding reference count ownership Christiaan Hofman May 10, 17:20
mlRe: Understanding reference count ownership Sherm Pendley May 10, 19:58
mlRe: Understanding reference count ownership Clark Cox May 10, 20:36