Program crash: GC destroys an object unexpectedly

eugene dee0xeed at gmail.com
Wed Sep 22 08:03:59 UTC 2021


On Tuesday, 21 September 2021 at 20:28:33 UTC, jfondren wrote:
>> Everything is Ok now,
>
> I don't think this is reliably OK. If you're not using Stopper 
> later in the function, and if there are no other references to 
> it, then the GC can collect it. It just has no obligation to 
> collect it, so minor differences like this might prevent that 
> from happening for particular compilers/options/versions.

I saw a thread on this forum named
'Why are so many programmers do not like GC'
or something like that.

After this adventure I would add my 5 cents:
because (sometimes, ok) it behaves absolutely
unpredictable, depending on operation order,
"particular compilers/options/versions" etc.




More information about the Digitalmars-d-learn mailing list