You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vera Petrashkova (JIRA)" <ji...@apache.org> on 2007/06/09 10:44:26 UTC

[jira] Created: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

[drlvm][gc] GC cannot work with fragmented heap with small heap size
--------------------------------------------------------------------

                 Key: HARMONY-4114
                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: Windows
            Reporter: Vera Petrashkova
            Priority: Minor


VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.

This test allocates bytes arrays of different sizes. 
The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 

Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.

On RI this test always passes with -Xmx64Mю
-------------fragTest.java------------
public class fragTest {
    public final static int NUM_IT = 1000000; 
    public final static int MAX_MEM =  44000000;
    public final static int BSIZE = 65536;
    public final static int MIN_BSIZE = 1;
    public final static int PERIOD = 25000;
    static int count=0;
    static int totalSize = 0;

    public static byte [][] ref = new byte [NUM_IT][];
    public static void main(String[] args) {
        int i = 0;
        try {
            for (; i < NUM_IT; ++i) {

                // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
                int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
                while (totalSize + size > MAX_MEM) {
                    size = size / 2;
                    if (size < MIN_BSIZE)
                        break;
                }
                if (size >= MIN_BSIZE) {
                    ref[i] = new byte[size];
                    totalSize += size;
                }
                count++;
                // clearing of arrays on PERIOD step
                if (count > PERIOD) {
                    // clearing of arrays is perfromed with the step,
                    // which varies from 2 to 13, so, the heap becomes
                    // fragmented
                    int step = (i % 13) + 2;

                    for(int j = 0; j<i; j+=step) {
                       if ( ref[j]!= null) {
                           totalSize-=ref[j].length; //recalculate total size
                           ref[j]= null;//clear array
                       }
                    }
                    count = 0;
//                    System.err.println("Total size = " + totalSize);

                }
            }
            System.err.println("Test passed, Total size = " + totalSize);
        } catch (OutOfMemoryError e) {
            System.err.println("OutOfMemoryError is thrown. Total size = "
                    + totalSize + " i = " + i);
            System.err.println("Test failed");
        }
    }
}
-----------------
Run this test several times.
java -Xmx64M fragTest


On RI output always is the following:
===============
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

Test passed, Total size = 44000000

DRLVM output:
=============
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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org
The GC did not provide gc_add_weak_root_set_entry()
OutOfMemoryError is thrown. Total size = 39269205 i = 50083
Test failed

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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org
The GC did not provide gc_add_weak_root_set_entry()
Out of Memory!


This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)


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


Re: [jira] Commented: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by Xiao-Feng Li <xi...@gmail.com>.
I don't think that's a bug. Different VMs or GCs have different max
fragmentation tolerance. It's acceptable. There is no reason to force
DRLVM to behave completely the same as RI.

Actually I found RI also has some problems with this test case. For
example, it throws the exception at MAX 63000000 even without
specifying -Xmx64m, but DRLVM doesn't. But I guess we don't want to
file a bug for DRLVM on this. :-)

On 6/15/07, Vera Petrashkova (JIRA) <ji...@apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505077 ]
>
> Vera Petrashkova commented on HARMONY-4114:
> -------------------------------------------
>
> I think the fix of this bug is not complete.
> If we change fragTest to define MAX_MEM value as test argument (see new test) then it passes with MAX_MEM 44000000 but it fails
> when MAX_MEM=58000000.
> On RI this test
> -------------fragTest.java----------
> public class fragTest {
>     public final static int NUM_IT = 1000000;
>     public  static int MAX_MEM = 44000000;              // change this field description
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {                                                               // add MAX_MEM definition
>             if (args.length > 0) {
>                 MAX_MEM = Integer.parseInt(args[0]);
>             }
>         } catch (Throwable e) {
>         }
>         try {
>             for (; i < NUM_IT; ++i) {
>
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -------------------------
> java -Xmx64M fragTest 44000000
> java -Xmx64M fragTest 58000000
>
>
> On RI:
> =====
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
>
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 58000000
>
>
> On Harmony-r547521
> =============
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its l
> icensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r547521, (Jun 15 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Test passed, Total size = 44000000
>
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its l
> icensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r547521, (Jun 15 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 56556930 i = 10635
> Test failed
>
>
>
> > [drlvm][gc] GC cannot work with fragmented heap with small heap size
> > --------------------------------------------------------------------
> >
> >                 Key: HARMONY-4114
> >                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
> >             Project: Harmony
> >          Issue Type: Bug
> >          Components: DRLVM
> >         Environment: Windows
> >            Reporter: Vera Petrashkova
> >            Assignee: Xiao-Feng Li
> >            Priority: Minor
> >         Attachments: patch-for-H4114-001.patch
> >
> >
> > VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> > This test allocates bytes arrays of different sizes.
> > The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> > Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high.
> > Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> > On RI this test always passes with -Xmx64Mю
> > -------------fragTest.java------------
> > public class fragTest {
> >     public final static int NUM_IT = 1000000;
> >     public final static int MAX_MEM =  44000000;
> >     public final static int BSIZE = 65536;
> >     public final static int MIN_BSIZE = 1;
> >     public final static int PERIOD = 25000;
> >     static int count=0;
> >     static int totalSize = 0;
> >     public static byte [][] ref = new byte [NUM_IT][];
> >     public static void main(String[] args) {
> >         int i = 0;
> >         try {
> >             for (; i < NUM_IT; ++i) {
> >                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
> >                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
> >                 while (totalSize + size > MAX_MEM) {
> >                     size = size / 2;
> >                     if (size < MIN_BSIZE)
> >                         break;
> >                 }
> >                 if (size >= MIN_BSIZE) {
> >                     ref[i] = new byte[size];
> >                     totalSize += size;
> >                 }
> >                 count++;
> >                 // clearing of arrays on PERIOD step
> >                 if (count > PERIOD) {
> >                     // clearing of arrays is perfromed with the step,
> >                     // which varies from 2 to 13, so, the heap becomes
> >                     // fragmented
> >                     int step = (i % 13) + 2;
> >                     for(int j = 0; j<i; j+=step) {
> >                        if ( ref[j]!= null) {
> >                            totalSize-=ref[j].length; //recalculate total size
> >                            ref[j]= null;//clear array
> >                        }
> >                     }
> >                     count = 0;
> > //                    System.err.println("Total size = " + totalSize);
> >                 }
> >             }
> >             System.err.println("Test passed, Total size = " + totalSize);
> >         } catch (OutOfMemoryError e) {
> >             System.err.println("OutOfMemoryError is thrown. Total size = "
> >                     + totalSize + " i = " + i);
> >             System.err.println("Test failed");
> >         }
> >     }
> > }
> > -----------------
> > Run this test several times.
> > java -Xmx64M fragTest
> > On RI output always is the following:
> > ===============
> > java version "1.5.0_06"
> > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> > Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> > Test passed, Total size = 44000000
> > DRLVM output:
> > =============
> > 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> > http://harmony.apache.org
> > The GC did not provide gc_add_weak_root_set_entry()
> > OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> > Test failed
> > 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> > http://harmony.apache.org
> > The GC did not provide gc_add_weak_root_set_entry()
> > Out of Memory!
> > This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
http://xiao-feng.blogspot.com

[jira] Commented: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Vera Petrashkova (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505222 ] 

Vera Petrashkova commented on HARMONY-4114:
-------------------------------------------

I rerun stress/org/apache/harmony/test/stress/gc/frag test subsuite on Harmony-r547521 and RI

The following tests  pass on RI  but they fail on Harmony with OOME

stress/org/apache/harmony/test/stress/gc/frag/FragmentationRandomTest1/FragmentationRandomTest1.xml 
stress/org/apache/harmony/test/stress/gc/frag/FragmentationSimpleRandomTest3/FragmentationSimpleRandomTest3.xml 
stress/org/apache/harmony/test/stress/gc/frag/FragmentationSimpleRandomTest4/FragmentationSimpleRandomTest4.xml 
stress/org/apache/harmony/test/stress/gc/frag/FragmentationSimpleRandomTest5/FragmentationSimpleRandomTest5.xml 
stress/org/apache/harmony/test/stress/gc/frag/FragmentationSimpleTest3/FragmentationSimpleTest3.xml 
stress/org/apache/harmony/test/stress/gc/frag/FragmentationSimpleTest4/FragmentationSimpleTest4.xml 
stress/org/apache/harmony/test/stress/gc/frag/FragmentationSimpleTest5/FragmentationSimpleTest5.xml 
stress/org/apache/harmony/test/stress/gc/frag/FragmentationSimpleTest6/FragmentationSimpleTest6.xml

These tests use -Xmx64M and try to create a byte arrays of defined size.
After specified step they free some  memory and repeat arrays creation.
Harmony does not reach the point of filling memory.
It reports OOME.







> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Commented: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531108 ] 

Alexei Fedotov commented on HARMONY-4114:
-----------------------------------------

should be applied:
5.   harness_test_handler.patch (30 kb)
7.   stress.patch (1.12 Mb)

should be executed:
1.   add_remove.sh (8 kb)




> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: harness_test_handler.patch

Lightening harness checks for xml files.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: add_remove.sh

remove -> add

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, patch-for-H4114-001.patch, stress.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Qi Ji (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Qi Ji updated HARMONY-4114:
---------------------------

    Attachment: patch-for-H4114-001.patch

This patch fix H4114 bug.

> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: check_xml_id.sh

Checks that file ID is correct.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: check_source_tag.pl, check_xml_id.sh, patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: stress_1.patch

Removed debug output

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch, stress_1.patch, stress_1.patch, stress_1.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Commented: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Vera Petrashkova (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505077 ] 

Vera Petrashkova commented on HARMONY-4114:
-------------------------------------------

I think the fix of this bug is not complete.
If we change fragTest to define MAX_MEM value as test argument (see new test) then it passes with MAX_MEM 44000000 but it fails
when MAX_MEM=58000000.
On RI this test
-------------fragTest.java----------
public class fragTest {
    public final static int NUM_IT = 1000000; 
    public  static int MAX_MEM = 44000000;              // change this field description
    public final static int BSIZE = 65536;
    public final static int MIN_BSIZE = 1;
    public final static int PERIOD = 25000;
    static int count=0;
    static int totalSize = 0;

    public static byte [][] ref = new byte [NUM_IT][];
    public static void main(String[] args) {
        int i = 0;
        try {                                                               // add MAX_MEM definition
            if (args.length > 0) {
                MAX_MEM = Integer.parseInt(args[0]);
            }
        } catch (Throwable e) {
        }    
        try {
            for (; i < NUM_IT; ++i) {

                // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
                int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
                while (totalSize + size > MAX_MEM) {
                    size = size / 2;
                    if (size < MIN_BSIZE)
                        break;
                }
                if (size >= MIN_BSIZE) {
                    ref[i] = new byte[size];
                    totalSize += size;
                }
                count++;
                // clearing of arrays on PERIOD step
                if (count > PERIOD) {
                    // clearing of arrays is perfromed with the step,
                    // which varies from 2 to 13, so, the heap becomes
                    // fragmented
                    int step = (i % 13) + 2;

                    for(int j = 0; j<i; j+=step) {
                       if ( ref[j]!= null) {
                           totalSize-=ref[j].length; //recalculate total size
                           ref[j]= null;//clear array
                       }
                    }
                    count = 0;
//                    System.err.println("Total size = " + totalSize);

                }
            }
            System.err.println("Test passed, Total size = " + totalSize);
        } catch (OutOfMemoryError e) {
            System.err.println("OutOfMemoryError is thrown. Total size = "
                    + totalSize + " i = " + i);
            System.err.println("Test failed");
        }
    }
}
-------------------------
java -Xmx64M fragTest 44000000
java -Xmx64M fragTest 58000000


On RI:
=====
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
Test passed, Total size = 44000000

java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
Test passed, Total size = 58000000


On Harmony-r547521
=============
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its l
icensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r547521, (Jun 15 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org
The GC did not provide gc_add_weak_root_set_entry()
Test passed, Total size = 44000000

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its l
icensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r547521, (Jun 15 2007), Windows/ia32/msvc 1310, release build
http://harmony.apache.org
The GC did not provide gc_add_weak_root_set_entry()
OutOfMemoryError is thrown. Total size = 56556930 i = 10635
Test failed



> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Commented: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12536637 ] 

Alexei Fedotov commented on HARMONY-4114:
-----------------------------------------

After some chatting Stepan and I had come to the decision to close this issue and open a new one about test issues: HARMONY-4992. This would help separating HDK and BTI issues for easier navigation.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch, stress_1.patch, stress_1.patch, stress_1.patch, stress_1.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Closed: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Stepan Mishura (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stepan Mishura closed HARMONY-4114.
-----------------------------------

    Resolution: Won't Fix

Closing as requested by Alexei Fedotov.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch, stress_1.patch, stress_1.patch, stress_1.patch, stress_1.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Commented: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Xiao-Feng Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505104 ] 

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

I don't think that's a bug. Different VMs or GCs have different max
fragmentation tolerance. It's acceptable. There is no reason to force
DRLVM to behave completely the same as RI.

Actually I found RI also has some problems with this test case. For
example, it throws the exception at MAX 63000000 even without
specifying -Xmx64m, but DRLVM doesn't. But I guess we don't want to
file a bug for DRLVM on this. :-)



-- 
http://xiao-feng.blogspot.com


> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Commented: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Xiao-Feng Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505029 ] 

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

Patch committed.

> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Assigned: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Xiao-Feng Li (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Xiao-Feng Li reassigned HARMONY-4114:
-------------------------------------

    Assignee: Xiao-Feng Li

> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Xiao-Feng Li (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Xiao-Feng Li updated HARMONY-4114:
----------------------------------

    Assignee:     (was: Xiao-Feng Li)
     Summary: [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI  (was: [drlvm][gc] GC cannot work with fragmented heap with small heap size)

Need to study the test case design. The execution itself is correct by throwing an OOME exception. Just the heap utilization rate is lower than RI, which is not a correctness issue of GC.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: stress.patch

Here are changes

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, check_source_tag.pl, check_xml_id.sh, patch-for-H4114-001.patch, stress.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Commented: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Xiao-Feng Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505230 ] 

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

Can you submit the test cases here? I seriously doubt about the test
cases' validity, since I don't hear any specs that require a JVM must
fully occupy the heap before throwing OOME. Thanks.



-- 
http://xiao-feng.blogspot.com


> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Commented: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size

Posted by "Xiao-Feng Li (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505048 ] 

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

Vera, would you please confirm if the commit fixes the bug? Thanks.

> [drlvm][gc] GC cannot work with fragmented heap with small heap size
> --------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Assignee: Xiao-Feng Li
>            Priority: Minor
>         Attachments: patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: stress_1.patch

Another revision of heap cleanup algorithm doesn't crash Sun's VM when fiinalizers contain a synchronized block.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch, stress_1.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: stress_1.patch

Undone automatic updates for cfg_env.xml.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch, stress_1.patch, stress_1.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: stress_1.patch

Added one more test, corrected new line breaks
svn add qa/src/test/stress/org/apache/harmony/test/stress/gc/frag/FragmentationReference/FragmentationSoftRefTest1024.xml

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, add_remove.sh, check_source_tag.pl, check_xml_id.sh, harness_test_handler.patch, patch-for-H4114-001.patch, stress.patch, stress_1.patch, stress_1.patch, stress_1.patch, stress_1.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: add_remove.sh

The script for moving files

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: add_remove.sh, check_source_tag.pl, check_xml_id.sh, patch-for-H4114-001.patch, stress.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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


[jira] Updated: (HARMONY-4114) [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI

Posted by "Alexei Fedotov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-4114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexei Fedotov updated HARMONY-4114:
------------------------------------

    Attachment: check_source_tag.pl

Checks that project xml files are correct.

> [drlvm][test] Fragmentation related tests report failure for lower heap utilization rate than RI
> ------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4114
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4114
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows
>            Reporter: Vera Petrashkova
>            Priority: Minor
>         Attachments: check_source_tag.pl, check_xml_id.sh, patch-for-H4114-001.patch
>
>
> VM intermittently throws unexpected OutOfMemoryError on the following test which defines heap fragmentation.
> This test allocates bytes arrays of different sizes. 
> The arrays sizes are up to the defined MAX memory, but it is always checked that the total arrays size does not reach this MAX value.
> Some of the arrays are deleted (assigned to null) with the step which varies from 2 to 13, so, fragmentation of heap becomes high. 
> Test fails on DRLVM  with -Xmx64M and sometimes VM crashes on this test without of throwing OutOfMemoryError.
> On RI this test always passes with -Xmx64Mю
> -------------fragTest.java------------
> public class fragTest {
>     public final static int NUM_IT = 1000000; 
>     public final static int MAX_MEM =  44000000;
>     public final static int BSIZE = 65536;
>     public final static int MIN_BSIZE = 1;
>     public final static int PERIOD = 25000;
>     static int count=0;
>     static int totalSize = 0;
>     public static byte [][] ref = new byte [NUM_IT][];
>     public static void main(String[] args) {
>         int i = 0;
>         try {
>             for (; i < NUM_IT; ++i) {
>                 // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE)
>                 int size = ((i + BSIZE) % BSIZE) + MIN_BSIZE;
>                 while (totalSize + size > MAX_MEM) {
>                     size = size / 2;
>                     if (size < MIN_BSIZE)
>                         break;
>                 }
>                 if (size >= MIN_BSIZE) {
>                     ref[i] = new byte[size];
>                     totalSize += size;
>                 }
>                 count++;
>                 // clearing of arrays on PERIOD step
>                 if (count > PERIOD) {
>                     // clearing of arrays is perfromed with the step,
>                     // which varies from 2 to 13, so, the heap becomes
>                     // fragmented
>                     int step = (i % 13) + 2;
>                     for(int j = 0; j<i; j+=step) {
>                        if ( ref[j]!= null) {
>                            totalSize-=ref[j].length; //recalculate total size
>                            ref[j]= null;//clear array
>                        }
>                     }
>                     count = 0;
> //                    System.err.println("Total size = " + totalSize);
>                 }
>             }
>             System.err.println("Test passed, Total size = " + totalSize);
>         } catch (OutOfMemoryError e) {
>             System.err.println("OutOfMemoryError is thrown. Total size = "
>                     + totalSize + " i = " + i);
>             System.err.println("Test failed");
>         }
>     }
> }
> -----------------
> Run this test several times.
> java -Xmx64M fragTest
> On RI output always is the following:
> ===============
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed, Total size = 44000000
> DRLVM output:
> =============
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> OutOfMemoryError is thrown. Total size = 39269205 i = 50083
> Test failed
> 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 = r545076, (Jun  7 2007), Windows/ia32/msvc 1310, release build
> http://harmony.apache.org
> The GC did not provide gc_add_weak_root_set_entry()
> Out of Memory!
> This bug causes the itermittent failures of  gc.frag tests from stress test suite (http://issues.apache.org/jira/browse/HARMONY-3536)

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