[Gc] Re: Do finalizers run at exit?

Achilleas Margaritis axilmar at otenet.gr
Sun Dec 30 00:52:42 PST 2007


Thanks everyone for your time replying to this issue.

I guess the problem is that there is no way to tell the C run time 
system to execute the gc cleanup as the absolutely last thing before 
deleting a process.

Now if anyone can clarify the issue with GC_INIT...

O/H Hans Boehm έγραψε:
> A slightly older version of the ACM POPL paper is available at
> 
> http://www.hpl.hp.com/techreports/2002/HPL-2002-335.html
> 
> The very short answer is that to run finalizers at exit, you need to 
> finalize objects that are still reachable, including those that are
> reachable from global variables and static data members.  Once you've
> finalized the first such object, it is very unclear what library
> routines still work correctly.  Thus it is unclear what subsequently
> run finalizers could safely do, and it wouldn't be much.  If you
> supported this, all finalizers would have to be prepared to run in
> an environment in which the libraries they really on are partially or
> completely broken.  I don't think this is a reasonable restriction.
> 
> The above paper gives a way to safely program around this restriction.
> 
> This is very different from repeatedly running collections until as many 
> objects as possible are finalized.  That is safe.
> 
> Hans
> 



More information about the Gc mailing list