[gclist] Mark don't sweep

Stefan Monnier stefan.monnier@lia.di.epfl.ch
Thu, 09 May 1996 12:03:07 +0200


> Again I don't approve of finalizers.

You're free to do so.

> First a garbage collector deletes objects when they can't effect the program.

Almost. They can still effect the program through "out of memory" exceptions
or heavy thrashing.

> A finalizer effects the program.

Nope. A finalizer *may* effect the program, but since you don't know when/if
it will be called, you'll be much better off writing non-effecting finalizers
to avoid subtle bugs.

I'm fairly convinced that the huge majority of finalizers written is
non-effecting.

> This is original sin.

I'd call it "bad programming practice".

> Second finalizers must me prompt and sure.

I'd say that differently: it is desirable for finalizers to be prompt and sure.

> If you have a chain of finalizer objects they only get killed at
> the rate of one per collection cycle.

Not necessarily, it all depends on the specific semantics (and/or
implementation) of finalizers.

> A loop of finalizer objects can never die.

Again not necessarily. Handling of circular dependencies between finalizable
objects is an "as yet not clearly solved problem. There are known solutions
already, even though they are not always satisfying.


	Stefan