GC: memory collected but destructors not called
Rainer Schuetze via Digitalmars-d
digitalmars-d at puremagic.com
Fri Nov 14 03:25:40 PST 2014
On 11.11.2014 21:41, Steven Schveighoffer wrote:
> In other words, putting a struct in the GC heap that was written to be
> scope-destroyed is an error before and after this pull. Before the pull,
> the dtor doesn't run, which is wrong, and after the pull the dtor may
> cause race issues, which is wrong. So either way, it's wrong :)
I think if someone uses "new" to allocate a struct on the GC heap, he
must be aware of the consequences of using the GC. What happens within
destruction/finalization is just the same as if it had been wrapped in a
class, and that's what everyone(?) expects.
More information about the Digitalmars-d
mailing list