[Issue 8139] Make objects really disposable by addition of "Object finalized" assertion
https://issues.dlang.org/show_bug.cgi?id=8139 Iain Buclaw changed: What|Removed |Added Priority|P2 |P4 --
[Issue 8139] Make objects really disposable by addition of Object finalized assertion
http://d.puremagic.com/issues/show_bug.cgi?id=8139 Alex R�nne Petersen a...@lycus.org changed: What|Removed |Added CC||a...@lycus.org --- Comment #1 from Alex R�nne Petersen a...@lycus.org 2012-05-24 12:46:56 CEST --- The idea in and of itself is not bad. In fact, it would make debugging wonderfully easy. My only concern is this: Object size. We already store two words of memory in *every single object header*. This means 8 bytes on 32-bit and 16 bytes on 64-bit. Now suppose we added an extra bool field to Object. Not only would the compiler have to be changed to align fields correctly, but it would also result in objects eating 12 bytes on 32-bit and 24 bytes on 64-bit (simply because the GC only power of two allocations or something along those lines). Now, the memory concern is not a problem for a class like this: class A { bool b; short s; } Obviously we don't need word alignment here, and we could probably optimize given that. But consider: class B { A a; } Suddenly that bool field has to suck an entire machine word's worth of space for 'a' to be aligned correctly. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8139] Make objects really disposable by addition of Object finalized assertion
http://d.puremagic.com/issues/show_bug.cgi?id=8139 --- Comment #2 from Denis Shelomovskij verylonglogin@gmail.com 2012-05-24 15:00:11 MSD --- (In reply to comment #1) Now suppose we added an extra bool field to Object. From Sean Kelly's reply at NG: rt_finalize currently nulls out the vtbl pointer, which can server as an isAlive flag if desired. Link: http://forum.dlang.org/thread/jo0p3a$aue$1...@digitalmars.com#post-mailman.323.1336157840.24740.digitalmars-d:40puremagic.com -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8139] Make objects really disposable by addition of Object finalized assertion
http://d.puremagic.com/issues/show_bug.cgi?id=8139 --- Comment #3 from Alex R�nne Petersen a...@lycus.org 2012-05-24 13:00:51 CEST --- In that case, I have no objections to doing this. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8139] Make objects really disposable by addition of Object finalized assertion
http://d.puremagic.com/issues/show_bug.cgi?id=8139 Jacob Carlborg d...@me.com changed: What|Removed |Added CC||d...@me.com --- Comment #4 from Jacob Carlborg d...@me.com 2012-05-24 05:10:01 PDT --- From Sean Kelly's reply at NG: rt_finalize currently nulls out the vtbl pointer, which can server as an isAlive flag if desired. Link: http://forum.dlang.org/thread/jo0p3a$aue$1...@digitalmars.com#post-mailman.323.1336157840.24740.digitalmars-d:40puremagic.com The vtbl is only needed for virtual methods. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 8139] Make objects really disposable by addition of Object finalized assertion
http://d.puremagic.com/issues/show_bug.cgi?id=8139 --- Comment #5 from Alex R�nne Petersen a...@lycus.org 2012-05-24 14:11:06 CEST --- It's still set for all objects because it contains a pointer to type info. (The other machine word is the monitor.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---