[Issue 1164] Wrong order of memory deallocation

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Dec 26 02:22:31 PST 2016


https://issues.dlang.org/show_bug.cgi?id=1164

--- Comment #9 from Pieter Penninckx <pieter.penninckx at scarlet.be> ---
Just to be sure I understand you correctly.

Am I right that the garbage collector currently works as follows:

* Mark (= mark all reachable objects as reachable)
* For each collectable (= non-reachable) object:
  * Call dtor
  * release memory of the collectable object

Am I right that the steps you are thinking about can also be formulated as
follows:

* Mark (= mark all reachable objects as reachable)
* For each collectable (= non-reachable) object:
  * Call dtor
  * Obliterate with .init
* For each collectable object:
  * release memory of the collectable object

--


More information about the Digitalmars-d-bugs mailing list