Skip navigation.
 
mlRe: Understanding reference count ownership
FROM : Christiaan Hofman
DATE : Thu May 08 15:32:24 2008

On 8 May 2008, at 3:16 PM, Paul Sargent wrote:

> On Thu, May 8, 2008 at 12:34 AM, mmalc Crawford <mmalc-
> <email_removed>>
> wrote:
>

>>
>> On May 7, 2008, at 2:47 PM, Christiaan Hofman wrote:
>>
>> No. The rule is that only methods containing "create", "copy", and 
>> "alloc"

>>> in their name implicitly retain.
>>>
>>> No, this is wrong.

>
>
> I have to say, even with a link to the documentation, that statement 
> just
> makes me more confused. I'm not sure what it is you're objecting to.
>
> Is it that objects returned by those methods haven't been 
> [retain]'d, they
> just haven't been [autorelease]'d?


I know, because I know what gets me confused. It's not "create" but 
"new". The confusion is partly due to the OP (who listed it as the 
part he said he understands), and partly due to Carbon, as there the 
similar keywords are "Copy" and "Create".

IMHO, I think the "new" rule was a mistake, because it's confusing 
(given the Carbon rule), and moreover it is rather an exception than a 
rule (I've never used it, and I know only a single example in Cocoa, 
which is an utterly expendable).

Also note that the documentation <http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html
> is not sacred, as it has exceptions (which are not mentioned in the 
ownership docs AFAICS).

Christiaan


Christiaan

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