| |
| Posted by rikki cattermole in reply to Elronnd | PermalinkReply |
|
rikki cattermole
Posted in reply to Elronnd
|
On 25/01/2022 8:22 PM, Elronnd wrote:
> On Tuesday, 25 January 2022 at 07:13:41 UTC, Paulo Pinto wrote:
>> ARC will also not compete, unless one goes the extra mile of making the compiler ARC aware, elide retain/release calls, do cascade deletions in background threads, take care on cascade deletions to avoid stack overflows on destructor calls, provide multicore friendly versions of them,.....
>
> Indeed. See Bacon et al, 'Unified Theory of Garbage Collection': increasingly sophisticated RC approaches tracing (and vice versa). So it's a bit strange to assume we can do one but not the other. And tracing makes a better starting point due to the generational hypothesis.
RC shines for when deterministic destruction is required.
So that is when you have any external resource bound to a D type.
But it is horrible as a language default. Not all types like say a pointer or a slice should be bound to any sort of memory management strategy in a native language.
It is very expensive compared to a GC. Due to the constant cache invalidations going on.
I want to get RC properly in D without having to rely on a struct wrapper. That way the compiler can know that eliding of calls can take place. Plus if its in the language, we can get const string type too with classes and all!
|