D3 - Programming in 3D

FeepingCreature feepingcreature at gmail.com
Mon Jun 15 10:40:30 UTC 2020


On Friday, 12 June 2020 at 21:00:20 UTC, drug007 wrote:
> On Friday, 12 June 2020 at 20:35:03 UTC, angel wrote:
>> 3. Reference counted memory management. It is predictable.
>
> Sorry for offtopic but why do you think so? Reference counted 
> memory management is a form of garbage collection and is 
> unpredictable too. Imagine you have a large tree and you free 
> the last reference to a node. All child of this node will be 
> freed and this process takes time depending on child nodes 
> count. It is unpredictable in general.

Your scenario sounds totally predictable? With refcounting you 
get a "free" mark phase (ref goes to 0), and then you know you're 
holding the only reference so you can just hand it off to a 
cleanup thread and stop thinking about it for the low cost of an 
atomic write.

Now, cycles do make it fully GC but they're in the control of the 
developer and can usually be broken with weak pointers. In 
general, people don't mind costs so long as they feel they're 
responsible for them and can do something about them. This is why 
people will always distrust stop-the-world GC for realtime tasks.


More information about the Digitalmars-d mailing list