collectNoStack should be axed
Daniel N
no at public.email
Sun Apr 21 19:57:04 UTC 2024
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.
More information about the Digitalmars-d
mailing list