POV-Ray : Newsgroups : povray.off-topic : A tale of two cities : Re: A tale of two cities Server Time
29 Jul 2024 18:19:51 EDT (-0400)
  Re: A tale of two cities  
From: clipka
Date: 14 Mar 2012 11:34:37
Message: <4f60ba8d$1@news.povray.org>
Am 14.03.2012 15:38, schrieb Invisible:
> On 14/03/2012 02:36 PM, clipka wrote:
>> Am 14.03.2012 10:55, schrieb Invisible:
>>
>>>> Note that the dispose is gone for good. Shared pointers use reference
>>>> counters to accomplish this feat.
>>>
>>> Every time I hear somebody say this, a part of me wants to scream "you
>>> /do/ understand that reference counting doesn't actually work, right?"
>>
>> Which is because...?
>
> Allow me to rephrase: Reference counting works if and only if the node
> reference graph is acyclic.
>
> Sometimes it's feasible to ensure that this is the case. Sometimes it is
> not.

While this is true, it is not a problem specific to reference counting, 
but one that is inherent in /any/ attempt at automatic object lifetime 
management.

That's why C++11 also provides weak pointers. They're not a cure-all for 
such problems, but they do help in some situations (such as when the 
cyclic references come from pointers to parent objects in a tree).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.