Workaround for typeid access violation
Etienne via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 16 07:40:18 PDT 2015
On Tuesday, 16 June 2015 at 14:32:45 UTC, Steven Schveighoffer
wrote:
> On 6/16/15 10:00 AM, Etienne wrote:
>> There is a bug regarding unordered object collection in the
>> GC. My
>> finalizer accesses another GC-allocated object
>
> Don't do that. Nothing is guaranteed in order of destruction.
> Note that after calling the destructor of an object, the vtable
> pointer is nulled.
>
> -Steve
Obviously the debugger shows that the object's destructor wasn't
called. I have the class set as final and all the locals are
there. Somehow its vtable is destroyed before though.
When I comment out the _d_invariant part at this point until the
end, I can do a crazy amount of requests (this is a webserver)
and there will be no crash at all.
So with the proper flags, its obviously possible to access a
"final class" object locals during destruction, isn't this why
the GC isn't re-entrant in the first place?
More information about the Digitalmars-d
mailing list