[Gc] Re: Do finalizers run at exit?

Achilleas Margaritis axilmar at otenet.gr
Mon Dec 31 01:43:30 PST 2007

O/H Bruce Hoult έγραψε:
> On Dec 30, 2007 4:01 AM, Achilleas Margaritis <axilmar at otenet.gr> wrote:
>> If you mean the ACM paper, I can not download it with the basic ACM
>> subscription. According to the site, I have to purchase a subscription.
>> Since I am not going to do that, could someone please explain to me why
>> finalizers can run after a collection, but not on program exit?
> Why did you not say that you hadn't read it?
> About 3 seconds with google shows that it is available at HP:
>    https://www.hpl.hp.com/techreports/2002/HPL-2002-335.html
> There is a saying: "God helps those who help themselves".

How am I supposed to know that a paper that I have to pay for to read is 
free elsewhere?

>> It's not a difficult question, is it? I am just asking why finalizers
>> are NOT invoked AT EXIT, while they are INVOKED after a COLLECTION.
> Yes, it *is* a difficult question, and not one that can be easily
> answered fully in a mailing list posting.  It requires understanding
> and subtle thinking.

Nope, it is not a difficult question. The reply is pretty simple, now 
that I understand it:

"Finalizers for all remaining blocks can not run at exit because memory 
allocated by the collector can be used by code that runs after the 
collector is terminated."

More information about the Gc mailing list