You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Maxim Makarov (JIRA)" <ji...@apache.org> on 2006/10/13 09:49:37 UTC

[jira] Created: (HARMONY-1854) [drlvm][unit] WeakReference has not been garbage collected using JET

[drlvm][unit] WeakReference has not been  garbage collected using JET
---------------------------------------------------------------------

                 Key: HARMONY-1854
                 URL: http://issues.apache.org/jira/browse/HARMONY-1854
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Maxim Makarov


Problem details:

    WeakReference has not been garbage collected using JET
  
Code for reproducing:

import java.lang.ref.WeakReference;

public class Test extends junit.framework.TestCase {

    public  void testTest() {

    try {
        Object pos = new Object();
        WeakReference  wr = new WeakReference(pos);

       for (int i = 0; i < 5; i++) {
                System.gc();
       }
       System.out.println(wr.get());
       assertNull("Position object hasn't been garbage collected", wr.get());

     }catch(Exception e){ 
     } 
   }
}       


Output on RI:
----------------

Note: Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
On RI

.null

Time: 0.203

OK (1 test)

On Harmony:
---------------
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r454528, (Oct 12 2006), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony

.java.lang.Object@2061ca2c
F
Time: 0.031
There was 1 failure:
1) testTest(Test)junit.framework.AssertionFailedError: Position object hasn't
been garbage collected
        at Test.testTest(Test.java:36)
        at java.lang.reflect.VMReflection.invokeMethod(Native Method)

FAILURES!!!
Tests run: 1,  Failures: 1,  Errors: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1854) [drlvm][unit] WeakReference has not been garbage collected using JET

Posted by "Maxim Makarov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1854?page=comments#action_12441979 ] 
            
Maxim Makarov commented on HARMONY-1854:
----------------------------------------

I agree with Mikhail, therefore
unit test javax.swing.text.GapContent_SerializeTest contains the unnecessary assertion.
I suggest to remove this check. (plz, see patch)


> [drlvm][unit] WeakReference has not been  garbage collected using JET
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-1854
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1854
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Maxim Makarov
>
> Problem details:
>     WeakReference has not been garbage collected using JET
>   
> Code for reproducing:
> import java.lang.ref.WeakReference;
> public class Test extends junit.framework.TestCase {
>     public  void testTest() {
>     try {
>         Object pos = new Object();
>         WeakReference  wr = new WeakReference(pos);
>        for (int i = 0; i < 5; i++) {
>                 System.gc();
>        }
>        System.out.println(wr.get());
>        assertNull("Position object hasn't been garbage collected", wr.get());
>      }catch(Exception e){ 
>      } 
>    }
> }       
> Output on RI:
> ----------------
> Note: Test.java uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> On RI
> .null
> Time: 0.203
> OK (1 test)
> On Harmony:
> ---------------
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r454528, (Oct 12 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> .java.lang.Object@2061ca2c
> F
> Time: 0.031
> There was 1 failure:
> 1) testTest(Test)junit.framework.AssertionFailedError: Position object hasn't
> been garbage collected
>         at Test.testTest(Test.java:36)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (HARMONY-1854) [drlvm][unit] WeakReference has not been garbage collected using JET

Posted by "Geir Magnusson Jr (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1854?page=all ]

Geir Magnusson Jr closed HARMONY-1854.
--------------------------------------

    Resolution: Fixed

Please re-file this as a classlibrary issue.  I was going to change it to classlib, but it's too baffling.

> [drlvm][unit] WeakReference has not been  garbage collected using JET
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-1854
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1854
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Maxim Makarov
>         Attachments: patch.txt
>
>
> Problem details:
>     WeakReference has not been garbage collected using JET
>   
> Code for reproducing:
> import java.lang.ref.WeakReference;
> public class Test extends junit.framework.TestCase {
>     public  void testTest() {
>     try {
>         Object pos = new Object();
>         WeakReference  wr = new WeakReference(pos);
>        for (int i = 0; i < 5; i++) {
>                 System.gc();
>        }
>        System.out.println(wr.get());
>        assertNull("Position object hasn't been garbage collected", wr.get());
>      }catch(Exception e){ 
>      } 
>    }
> }       
> Output on RI:
> ----------------
> Note: Test.java uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> On RI
> .null
> Time: 0.203
> OK (1 test)
> On Harmony:
> ---------------
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r454528, (Oct 12 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> .java.lang.Object@2061ca2c
> F
> Time: 0.031
> There was 1 failure:
> 1) testTest(Test)junit.framework.AssertionFailedError: Position object hasn't
> been garbage collected
>         at Test.testTest(Test.java:36)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-1854) [drlvm][unit] WeakReference has not been garbage collected using JET

Posted by "Mikhail Fursov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-1854?page=comments#action_12441953 ] 
            
Mikhail Fursov commented on HARMONY-1854:
-----------------------------------------

I think that test is not correct.
There are 2 reasons:

1) I tried this version of test and it passed on BEA but fails on SUN (both v1.5)

import java.lang.ref.*;

public class Test {

    public static void main(String[] args) {
        Object pos = new Object();
        WeakReference wr = new WeakReference(pos);
        for (int i = 0; i < 5; i++) {
            System.gc();
        }
        System.out.println("Position object: "+ wr.get());
    }
}

On SUN it reports: Position object: java.lang.Object@182f0db

2) You can't predict if object is live of dead in JIT from the Java code.


> [drlvm][unit] WeakReference has not been  garbage collected using JET
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-1854
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1854
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Maxim Makarov
>
> Problem details:
>     WeakReference has not been garbage collected using JET
>   
> Code for reproducing:
> import java.lang.ref.WeakReference;
> public class Test extends junit.framework.TestCase {
>     public  void testTest() {
>     try {
>         Object pos = new Object();
>         WeakReference  wr = new WeakReference(pos);
>        for (int i = 0; i < 5; i++) {
>                 System.gc();
>        }
>        System.out.println(wr.get());
>        assertNull("Position object hasn't been garbage collected", wr.get());
>      }catch(Exception e){ 
>      } 
>    }
> }       
> Output on RI:
> ----------------
> Note: Test.java uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> On RI
> .null
> Time: 0.203
> OK (1 test)
> On Harmony:
> ---------------
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r454528, (Oct 12 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> .java.lang.Object@2061ca2c
> F
> Time: 0.031
> There was 1 failure:
> 1) testTest(Test)junit.framework.AssertionFailedError: Position object hasn't
> been garbage collected
>         at Test.testTest(Test.java:36)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-1854) [drlvm][unit] WeakReference has not been garbage collected using JET

Posted by "Maxim Makarov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-1854?page=all ]

Maxim Makarov updated HARMONY-1854:
-----------------------------------

    Attachment: patch.txt

> [drlvm][unit] WeakReference has not been  garbage collected using JET
> ---------------------------------------------------------------------
>
>                 Key: HARMONY-1854
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1854
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Maxim Makarov
>         Attachments: patch.txt
>
>
> Problem details:
>     WeakReference has not been garbage collected using JET
>   
> Code for reproducing:
> import java.lang.ref.WeakReference;
> public class Test extends junit.framework.TestCase {
>     public  void testTest() {
>     try {
>         Object pos = new Object();
>         WeakReference  wr = new WeakReference(pos);
>        for (int i = 0; i < 5; i++) {
>                 System.gc();
>        }
>        System.out.println(wr.get());
>        assertNull("Position object hasn't been garbage collected", wr.get());
>      }catch(Exception e){ 
>      } 
>    }
> }       
> Output on RI:
> ----------------
> Note: Test.java uses unchecked or unsafe operations.
> Note: Recompile with -Xlint:unchecked for details.
> On RI
> .null
> Time: 0.203
> OK (1 test)
> On Harmony:
> ---------------
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r454528, (Oct 12 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> .java.lang.Object@2061ca2c
> F
> Time: 0.031
> There was 1 failure:
> 1) testTest(Test)junit.framework.AssertionFailedError: Position object hasn't
> been garbage collected
>         at Test.testTest(Test.java:36)
>         at java.lang.reflect.VMReflection.invokeMethod(Native Method)
> FAILURES!!!
> Tests run: 1,  Failures: 1,  Errors: 0

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira