POV-Ray : Newsgroups : povray.off-topic : A tale of two cities : Re: A tale of two cities Server Time
29 Jul 2024 18:21:41 EDT (-0400)
  Re: A tale of two cities  
From: Invisible
Date: 14 Mar 2012 11:39:30
Message: <4f60bbb2$1@news.povray.org>
>> 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.

And automatic garbage collection is the only general-purpose solution to 
this problem. Unfortunately, it's also very expensive (in time and often 
in space).

> 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).

I'm not even sure what the semantics of a "weak pointer" would be in the 
absence of automatic memory management...


Post a reply to this message

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