[Issue 12256] New: Neither arrays nor associative arrays finalize their data
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 25 15:36:10 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12256
Summary: Neither arrays nor associative arrays finalize their
data
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: rswhite4 at googlemail.com
--- Comment #0 from rswhite4 at googlemail.com 2014-02-25 15:36:05 PST ---
I expect this is an known issue but we may should fix this:
----
import std.stdio;
struct Foo {
this(this) {
writeln("Copy");
}
~this() {
writeln("DTor");
}
}
void main() {
Foo[] fs;
fs ~= Foo();
Foo[int] fas;
fas[42] = Foo();
// Even this doesn't change anything
//destroy(fas);
//destroy(fs);
}
----
You will never see "DTor". But if you work with ref count or C memory you would
hope and expect that your data is finalized. So, the compiler should finalize
the data if they is collected. Unfortunately I expect that we need a precise GC
for that? IMO the current behaviour is unexpected and bug prone.
As _workaround_ it would be helpful if destroy would work that way, but
currently it doesn't.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list