FROM : John Stiles
DATE : Tue Apr 19 17:45:10 2005
You know, the computer only has 4 billion bytes of memory, and even the
most trivial of objects is 8 bytes (it needs an isa and a refcount).
FWIW, to answer the original question:
- refcounts are 32-bit ints
- I am not 100% sure, but I believe they cap at 4 billion (as opposed
to overflowing)
At any rate, just the process of trying to retain an object billions of
times is going to take a whole lot of CPU time, so it's probably best
to avoid it.
It *is* possible to make objects that can be released over and over
again without ever being freed. This might make your life easier. (I
think you override the class and make -retainCount return UINT_MAX.)
On Apr 18, 2005, at 10:05 PM, Daniel Jalkut wrote:
> This is an interesting question, but I think you need to ask yourself
> a question. When you get to the point where you're clearly pushing the
> limits of a system's design, maybe you be doing it another way?
>
> I would be suspicious of any design that requires an object to be
> retained by billions of other objects. Is it possible that your
> "ownership" model is such that the billion objects can contain an
> unretained reference instead of a retained one? If this is a
> situation where objects need to "back-reference" container or owner
> objects, then it often makes sense to make those references unretained
> to avoid circular ownership problems.
>
> It seems unlikely that a billion objects could all have a legitimate
> claim of ownership over an object within one iteration of the run
> loop. Maybe you can elaborate on your situation if you think it's
> well warranted...
>
> Daniel
>
> On Apr 18, 2005, at 1:43 PM, Ivan S. Kourtev wrote:
>
>> Hello,
>>
>> I wasn't able to find any documented upper limits on retain count on
>> 32-bit machines (or in general). I am interested in knowing this
>> because I foresee a situation where I may have objects with retain
>> counts of hundreds of millions of billions and more. So the two
>> questions I have are:
>>
>> (1) is there a documented limit to the retain count?
>> (2) is there a documented behavior once the retain count max is
>> reached?
>>
>> Thanks,
>>
>> --
>> ivan
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>-
>> sweater.com
>>
>> This email sent to <email_removed>
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Tue Apr 19 17:45:10 2005
You know, the computer only has 4 billion bytes of memory, and even the
most trivial of objects is 8 bytes (it needs an isa and a refcount).
FWIW, to answer the original question:
- refcounts are 32-bit ints
- I am not 100% sure, but I believe they cap at 4 billion (as opposed
to overflowing)
At any rate, just the process of trying to retain an object billions of
times is going to take a whole lot of CPU time, so it's probably best
to avoid it.
It *is* possible to make objects that can be released over and over
again without ever being freed. This might make your life easier. (I
think you override the class and make -retainCount return UINT_MAX.)
On Apr 18, 2005, at 10:05 PM, Daniel Jalkut wrote:
> This is an interesting question, but I think you need to ask yourself
> a question. When you get to the point where you're clearly pushing the
> limits of a system's design, maybe you be doing it another way?
>
> I would be suspicious of any design that requires an object to be
> retained by billions of other objects. Is it possible that your
> "ownership" model is such that the billion objects can contain an
> unretained reference instead of a retained one? If this is a
> situation where objects need to "back-reference" container or owner
> objects, then it often makes sense to make those references unretained
> to avoid circular ownership problems.
>
> It seems unlikely that a billion objects could all have a legitimate
> claim of ownership over an object within one iteration of the run
> loop. Maybe you can elaborate on your situation if you think it's
> well warranted...
>
> Daniel
>
> On Apr 18, 2005, at 1:43 PM, Ivan S. Kourtev wrote:
>
>> Hello,
>>
>> I wasn't able to find any documented upper limits on retain count on
>> 32-bit machines (or in general). I am interested in knowing this
>> because I foresee a situation where I may have objects with retain
>> counts of hundreds of millions of billions and more. So the two
>> questions I have are:
>>
>> (1) is there a documented limit to the retain count?
>> (2) is there a documented behavior once the retain count max is
>> reached?
>>
>> Thanks,
>>
>> --
>> ivan
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>-
>> sweater.com
>>
>> This email sent to <email_removed>
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Ivan S. Kourtev | Apr 18, 22:43 | |
| Daniel Jalkut | Apr 19, 07:05 | |
| John Stiles | Apr 19, 17:45 | |
| j o a r | Apr 19, 18:19 | |
| Axel Andersson | Apr 19, 18:44 | |
| Ali Ozer | Apr 19, 18:46 | |
| Ondra Cada | Apr 19, 18:57 | |
| Ivan S. Kourtev | Apr 19, 20:30 | |
| Ondra Cada | Apr 19, 20:55 | |
| Shaun Wexler | Apr 19, 21:05 | |
| Shaun Wexler | Apr 19, 21:09 | |
| Scott Ribe | Apr 23, 00:25 | |
| Bob Ippolito | Apr 23, 00:40 | |
| Scott Ribe | Apr 23, 00:51 | |
| Bob Ippolito | Apr 23, 06:57 | |
| Johnny Deadman | Apr 23, 18:44 |






Cocoa mail archive

