Re: JavaMemoryModel: Finalization idioms

From: Jeremy Manson (jmanson@cs.umd.edu)
Date: Sat Apr 30 2005 - 18:32:09 EDT


Boehm, Hans wrote:
> Opinions?

Here are some of my thoughts:

1) You could consider showing them the code for keepAlive, and telling
them to use it. You don't even necessarily have to go into that much
detail about how it works. They will then litter their code with very
sensible looking calls to their individual keepAlive() methods, which is
what their code would look like if we actually gave them keepAlive().

2) Why is the volatile option uglier than enforcing mutual exclusion
where none is necessary? Is it because volatiles are necessarily ugly
(the answer to this may be yes)? Isn't it uglier to have empty sync
blocks cluttering your code?

3) If you do choose option number three (or even if you don't), don't
forget to mention that finalizers can be run concurrently, so they may
have to synchronize their finalizers anyway.

4) We still should have some sort of built in keepAlive method. And a
way of initializing final fields sensibly. This is neither here nor
there, really :) .

                                        Jeremy
-------------------------------
JavaMemoryModel mailing list - http://www.cs.umd.edu/~pugh/java/memoryModel



This archive was generated by hypermail 2b29 : Thu Oct 13 2005 - 07:01:09 EDT