[concurrency-interest] Significance of volatile static

Boehm, Hans hans.boehm at hp.com
Thu Jun 23 15:16:56 EDT 2011

This problem occurs if, during an execution of a method M on a finalizable object, the reference to this or to an argument of M no longer appear to the garbage collector to be reachable.  I think that most x86-32 calling conventions end up passing this pointers and arguments on the stack, and are unlikely to reuse that memory while the method is running.  Thus they're likely to be viewed as reachable by the collector, even after M is done accessing them (but may still be accessing other referenced objects, which would be cleaned up by the finalizer).

x86-64 calling conventions tend to call for passing such things in registers, where they are likely to be overwritten once they are no longer needed.  At that point, the garbage collector will no longer see the object itself as live, the finalizer may run and destroy referenced objects (like an underlying OS file object) which are still being accessed by the method.

Thus, I think things are significantly more likely to fail on x86-64 or RISC architectures, than on architectures like x86-32 that have very few general purpose registers.  But there is no guarantee that code ignoring this problem will work on either.


From: concurrency-interest-bounces at cs.oswego.edu [mailto:concurrency-interest-bounces at cs.oswego.edu] On Behalf Of Mark Thornton
Sent: Thursday, June 23, 2011 12:36 AM
To: concurrency-interest at cs.oswego.edu
Subject: Re: [concurrency-interest] Significance of volatile static

On 23/06/11 00:59, Boehm, Hans wrote:

As it stands, I suspect little real code uses any of these techniques, and a lot of (most?) Java code using finalizers or weak references is still broken.  But it works correctly most of the time, especially on x86-32.

Does the concurrent behaviour of x86-64 differ significantly from x86-32?

Mark Thornton

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20110623/712bdae1/attachment.html>

More information about the Concurrency-interest mailing list