You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A static array of structs with destructors does not call the finalizers on collection.
example:
structS {
~this() {
importstd.stdio;
writeln("dtor");
}
}
voidmain() {
auto arr = new S[1][1];
}
// no output
It is within spec to not guarantee destructors are called, but it is usually expected that if the memory allocated is collected (as it is in this case), the destructor will be called.
Imagine a case where a destructor removes its memory with some C library registry. If the dtor is not called but the memory is freed, then you have a dangling pointer still in the registry.
The text was updated successfully, but these errors were encountered:
A static array of structs with destructors does not call the finalizers on collection.
example:
It is within spec to not guarantee destructors are called, but it is usually expected that if the memory allocated is collected (as it is in this case), the destructor will be called.
Imagine a case where a destructor removes its memory with some C library registry. If the dtor is not called but the memory is freed, then you have a dangling pointer still in the registry.
The text was updated successfully, but these errors were encountered: