Re: Encapsulate C struct/toll-free bridging?
Re: Encapsulate C struct/toll-free bridging?
- Subject: Re: Encapsulate C struct/toll-free bridging?
- From: Alastair Houghton <email@hidden>
- Date: Wed, 10 Mar 2004 14:24:53 +0000
On 10 Mar 2004, at 00:32, Allan Odgaard wrote:
>
But another problem is the reference counting (if the object should be
>
used as an ObjC object, I guess it really ought to implement retain
>
and release) -- to me it is not clear from the documentation where the
>
reference count is stored [...]
The reference count is stored externally (presumably in a hash table,
using the objects' addresses as the keys), but only if the count is
greater than 1. Objects with a reference count of 1 don't need storage
space for the reference count, because the existence of the object
implies a non-zero reference count.
Put another way, if an object doesn't have an external reference count
and it is sent a -release, then it will be deallocated; if the external
reference count drops to 1, the reference count itself will be
deallocated. Equally, if you -retain an object with a reference count
of 1, the framework will create a new external reference count for it.
At least, that's how I understand it.
Kind regards,
Alastair.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.