harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-4867) [drlvm][gc] System.runFinalization() returns before finishing finalization
Date Tue, 06 Nov 2007 09:02:16 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-4867?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12540381
] 

Xiao-Feng Li commented on HARMONY-4867:
---------------------------------------

Hi, Andrey, it looks not a bug. This some issue related with the understanding of the spec.
First of all, there is no guarantee that the all the dead objects will be reclaimed by System.gc().
 Secondly, there is no guarantee that System.runFinalization will finish all the finalizers.
 

I would suggest to avoid this kind of test case which has undefinite semantic.

Thanks.

> [drlvm][gc] System.runFinalization() returns before finishing finalization
> --------------------------------------------------------------------------
>
>                 Key: HARMONY-4867
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4867
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Andrey Pavlenko
>            Assignee: Xiao-Feng Li
>
> I'm not sure if it's a bug or incorrect test, but it causes an intermittent failure of
the functional test functional.org.apache.harmony.test.func.reg.vm.btest6572. As I can see
GC invokes the method Finalizator.finalize(), but it returns control before the method is
finished.
> See the following reproducer:
> public class Test {
> 	public static void main(String[] args) throws Exception {
> 		new Finalizator();
> 		System.gc();
> 		System.runFinalization();
> 		synchronized (Finalizator.LockObj) {
> 			if (Finalizator.finalized) {
> 				System.out.println("PASSED");
> 			} else {
> 				System.out.println("FAILED: " + Finalizator.b);
> 			}
> 		}
> 	}
> 	static class Finalizator {
> 		static Object LockObj = new Object();
> 		static boolean finalized = false;
> 		static boolean b;
> 		protected void finalize() throws Throwable {
> 			b = true;
> 			System.runFinalization();
> 			synchronized (LockObj) {
> 				finalized = true;
> 			}
> 		}
> 	}
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message