steve said:
anyone have a url for a good functional comparison between deterministic and
non-deterministic object finalization...pros and cons for each?
I assume by deterministic finalization, you mean something like C++
destructors, where there is a well defined place in the program that the
destructor will be called, and non-deterministic finalization is like
Java finalizers, where the program has no direct control over if or when
the finalizer will be called.
For deterministic finalization to work, you either need the compiler to
be able to determine where an object's lifetime ends, as in C++, or use
a automatic reference-counted memory management scheme, such as in Perl
or Python. I don't believe deterministic finalization is compatible
with non-reference-counted garbage collection, since only the garbage
collector can determine when there are no more references to an object.
To make a garbage collected language like Java call finalizers as soon
as the last reference went away, you'd need to synchronously call the
garbage collector every time a reference value was changed, which would
be horribly inefficient.
So maybe a good starting point for you would be to research the relative
advantages of garbage collection, automatic reference counting, and
manual memory management schemes.
Adam