Since dynamic arrays don't call the DTor of their elements (thanks to the silly GC) _and_ the destroy method don't call them as well (see issue #12256 : https://d.puremagic.com/issues/show_bug.cgi?id=12256) I suggest to add a finalize method to object.d. Something like:
----
void finalize(T)(T[] slice) {
static if(is(T == struct) || is(T == class)) {
foreach (ref T value; slice) {
.destroy!(T)(value);
}
}
slice = null; // or: destroy(slice);
}
----
Or we extend the related destroy method with the static if.
Comment #1 by robert.schadek — 2024-12-07T13:33:30Z