GC object finalization not guaranteed
Leandro Lucarella
llucax at gmail.com
Sun Apr 19 08:48:13 PDT 2009
Unknown W. Brackets, el 18 de abril a las 16:51 me escribiste:
> Well, I guess it would be doable to guarantee destruction, but *only* if
> order of destruction was not guaranteed.
Yes, of course, order *can't* be guaranteed (unless you add read/write
barriers and a lot of overhead at least =)
> In other words, at the end, the GC would not scan, it would just
> destroy.
Yes, that's the proposal.
> Scanning is a problem, due to cycles and various other things,
I don't see any problems with scanning, it's just time-consuming and
provides no benefits. Even more, the actual implementation do
a fullcollect() (which marks, scans and sweeps).
> but destroying all roots would be potentially doable.
My proposal is to destroy everything live. There is no need to follow the
roots, all memory known as live should be finalized. Again, there is no
need on scanning the roots.
> I disagree that a log file needs guaranteed finalization, however. It's
> when you think that way that you ignore the possibility of hardware
> failure. I'm a server guy - and all the daemons I use log immediately
> to the filesystem, without buffering. Anything else would be
> unacceptable.
Maybe you don't need that kind of security, but you would like your
program to behave as expected in normal situations (i.e. when no hardware
failure is involved).
Anyway the problem is no because of some example (I think it was a big
mistake from my part to take the discussion into the examples field). The
problem is the specs says now that "The garbage collector is not
guaranteed to run the destructor for all unreferenced objects.", it
doesn't say this is only applicable for destruction at the end of the
program. As far as the specs go, a GC that don't call finalizers during
collection *ever* is conforming.
--
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------
Hay manos capaces de fabricar herramientas
con las que se hacen máquinas para hacer ordenadores
que a su vez diseñan máquinas que hacen herramientas
para que las use la mano
More information about the Digitalmars-d
mailing list