[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Mauve patch
From: |
Mark Wielaard |
Subject: |
Re: Mauve patch |
Date: |
Thu, 15 Apr 2004 23:03:52 +0200 |
Hi,
On Tue, 2004-04-06 at 15:46, Archie Cobbs wrote:
> This patch doesn't guarantee anything, and in general it's impossible
> to make this test "correct" because the spec allows finalization and
> reference enqueuing to happen after arbitrarily long delays.
>
> For example, a JVM that *never* finalizes is still within the spec
> (it would probably throw OutOfMemoryError's more readily though).
>
> This patch simply makes the test "correct" for JC (and possibly
> some other VM(s) out there). Since there's no way to *ensure* the
> finalizer and reference enqueing thread(s) have run, we just try
> to give them every opportunity to do so before declaring that their
> work should be done.
I committed it to mauve as follows since it doesn't break things for
others and might actually help.
2004-04-15 Archie Cobbs <address@hidden>
* gnu/testlet/java/lang/ref/PhantomReference/phantom.java: Give the
runtime some more hints (Thread.yield/System.gc) that it should
really garbage collect.
But a "non-portable" section in Mauve is also a good idea. It is just
more work :)
Cheers,
Mark
Index: gnu/testlet/java/lang/ref/PhantomReference/phantom.java
===================================================================
RCS file:
/cvs/mauve/mauve/gnu/testlet/java/lang/ref/PhantomReference/phantom.java,v
retrieving revision 1.1
diff -u -r1.1 phantom.java
--- gnu/testlet/java/lang/ref/PhantomReference/phantom.java 27 Sep 2001
15:44:09 -0000 1.1
+++ gnu/testlet/java/lang/ref/PhantomReference/phantom.java 15 Apr 2004
20:18:34 -0000
@@ -54,6 +54,9 @@
phantom twt = new phantom ();
PhantomReference wr = genRef (q, twt);
+ // Give the runtime some hints that it should really garbage collect.
+ System.gc ();
+ System.yield ();
System.gc ();
Reference r = q.poll ();
signature.asc
Description: This is a digitally signed message part