On Wed, Oct 22, 2008 at 12:54 PM, Marco Masser <[EMAIL PROTECTED]> wrote:
>>> P.S.: I just tested NSGradient's -getColor:location:atIndex: method (the
>>> only one I could find that returns an object by reference) and here too, the
>>> first parameter (an NSColor **) has a retain count of 1 and is not
>>> autoreleased.
>>
>> How do you know that it isn't autoreleased?
>
> I don't know of any way to look into an autorelease pool, if you mean that :
>
> I just made an NSColor ivar and retained it after calling
> -getColor:location:atIndex: and took a look on its retain count in a second
> method that was called after the NSAutoreleasePool had been drained (i.e. I
> took a look at the retain count after pressing a button). That way, all
> -autorelease messages must have been dealt with. In the second method, the
> count was 2. After removing the -retain following the -getColor..., the
> retain count in the second method was 1.

That still means nothing, you rarely get useful information from
inspecting an object's retain count. You should just follow all of the
normal memory management rules, and forget that the retainCount method
even exists. In this case, you are not responsible for releasing the
color that you get back from -getColor:location:atIndex:.

-- 
Clark S. Cox III
[EMAIL PROTECTED]
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to