collectNoStack should be axed
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sun Apr 21 20:01:17 UTC 2024
On 22/04/2024 7:57 AM, Daniel N wrote:
> On Sunday, 21 April 2024 at 19:28:11 UTC, Steven Schveighoffer wrote:
>>
>> If they don't get a printout, they post an angry/confused message on
>> the forums saying
>>
>> ### Y U No work GC?
>>
>> If the stack of `main` is scanned, it's possible there's still a
>> reference to the `s` there. It could even still be in registers for
>> the thread. And that might mean that the GC won't clean it up.
>>
>> The truth is, there is no guarantee any destructors are run. And
>> especially in 32-bit D (which is what D was exclusively for a long
>> time), random 32-bit numbers might accidentally "point" at the memory
>> block.
>>
>
> Great digging, I suspect your are correct.
>
> Why do we even support destructors for GC allocated objects? You can't
> depend on it closing file-descriptors or other resources.
I understand why removing it would seem like a great idea.
But it would mean total segmentation of reference counted types from
going into non-RC memory.
I can't even get Walter to agree to have RC in the language (even if it
is reluctantly), let alone that...
More information about the Digitalmars-d
mailing list