D3 - Programming in 3D

FeepingCreature feepingcreature at gmail.com
Wed Jun 17 07:27:53 UTC 2020


On Tuesday, 16 June 2020 at 12:35:35 UTC, drug wrote:
> 16.06.2020 13:23, FeepingCreature пишет:
>> On Monday, 15 June 2020 at 14:38:31 UTC, drug wrote:
>>> 15.06.2020 13:40, FeepingCreature пишет:
>>>> 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.
>>>>
>>>
>>> How do you know that you have the only reference? the node 
>>> can be both the root and a leaf node.
>>>
>> 
>> You know you have the only reference because your refcount 
>> goes to 0...
>
> How do you know how many childs this node has? You don't know 
> the height of the subtree, so you can't predict how many childs 
> will be freed.

The point is you don't need to worry about this memory in the 
main thread anymore, so you can gradually free it in a background 
thread and it doesn't matter how many children it has, because 
the problem with memory management isn't CPU consumption but 
latency, and the latency of "send this pointer to the cleanup 
thread" is constant.


More information about the Digitalmars-d mailing list