Re: CFGetRetainCount question
Re: CFGetRetainCount question
- Subject: Re: CFGetRetainCount question
- From: Dmitry Markman <email@hidden>
- Date: Sat, 05 Jul 2008 01:05:48 -0400
thanks, Eli
it was clear from the context that I don't have to release object that
I got from CFArray
but I was just curious
thanks again
On Jul 5, 2008, at 12:03 AM, Eli Bach wrote:
On Jul 4, 2008, at 8:43 PM, Dmitry Markman wrote:
well I found some information in the NSObject's retainCount method
documentation:
"You rarely send a retainCount message; however, you might
implement this method in a class to implement your own reference-
counting scheme. For objects that never get released (that is,
theirrelease method does nothing), this method should return
UINT_MAX, as defined in <limits.h>"
but UINT_MAX is 4294967295 (0xFFFFFFFF)
so what does 0x7FFFFFFF mean?
thanks
Dmitry,
I don't think this is explicitly spelled out anywhere, but for CF
"constants", such as CFSTR("blah"), kCFBooleanFalse, and other
constant 'things' like this, there is no real meaning to releasing
them, but depending on your program's abstraction classes or
whatever, you may retain/release these CF constants. I believe CF
special-cases this specific retaincount as a do-nothing operation.
And 0x7FFFFFFF would be INT_MAX or SINT_MAX (which is the maximum
for a signed long (which is what a CFIndex is, which is the return
type for CFGetRetainCount()) [at least for 32-bit architecture,
probably for 64-bit architecture].
Technically, you could retain any given CF object enough to hit this
value, but you're program probably would have other problems before
you hit this limit.
Dmitry Markman
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden