Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 36908 invoked from network); 15 Jun 2007 03:39:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Jun 2007 03:39:47 -0000 Received: (qmail 48890 invoked by uid 500); 15 Jun 2007 03:39:50 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 48875 invoked by uid 500); 15 Jun 2007 03:39:50 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 48866 invoked by uid 99); 15 Jun 2007 03:39:50 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2007 20:39:50 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jun 2007 20:39:46 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 6363471419B for ; Thu, 14 Jun 2007 20:39:26 -0700 (PDT) Message-ID: <23587105.1181878766404.JavaMail.jira@brutus> Date: Thu, 14 Jun 2007 20:39:26 -0700 (PDT) From: "Qi Ji (JIRA)" To: commits@harmony.apache.org Subject: [jira] Updated: (HARMONY-4114) [drlvm][gc] GC cannot work with fragmented heap with small heap size In-Reply-To: <27640491.1181378666066.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/HARMONY-4114?page=3Dcom.atlass= ian.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 tes= t which defines heap fragmentation. > This test allocates bytes arrays of different sizes.=20 > The arrays sizes are up to the defined MAX memory, but it is always check= ed that the total arrays size does not reach this MAX value. > Some of the arrays are deleted (assigned to null) with the step which var= ies from 2 to 13, so, fragmentation of heap becomes high.=20 > Test fails on DRLVM with -Xmx64M and sometimes VM crashes on this test w= ithout of throwing OutOfMemoryError. > On RI this test always passes with -Xmx64M=D1=8E > -------------fragTest.java------------ > public class fragTest { > public final static int NUM_IT =3D 1000000;=20 > public final static int MAX_MEM =3D 44000000; > public final static int BSIZE =3D 65536; > public final static int MIN_BSIZE =3D 1; > public final static int PERIOD =3D 25000; > static int count=3D0; > static int totalSize =3D 0; > public static byte [][] ref =3D new byte [NUM_IT][]; > public static void main(String[] args) { > int i =3D 0; > try { > for (; i < NUM_IT; ++i) { > // size varies from MIN_BSIZE to (BSIZE + MIN_BSIZE) > int size =3D ((i + BSIZE) % BSIZE) + MIN_BSIZE; > while (totalSize + size > MAX_MEM) { > size =3D size / 2; > if (size < MIN_BSIZE) > break; > } > if (size >=3D MIN_BSIZE) { > ref[i] =3D new byte[size]; > totalSize +=3D 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 =3D (i % 13) + 2; > for(int j =3D 0; j if ( ref[j]!=3D null) { > totalSize-=3Dref[j].length; //recalculate tota= l size > ref[j]=3D null;//clear array > } > } > count =3D 0; > // System.err.println("Total size =3D " + totalSize); > } > } > System.err.println("Test passed, Total size =3D " + totalSize= ); > } catch (OutOfMemoryError e) { > System.err.println("OutOfMemoryError is thrown. Total size = =3D " > + totalSize + " i =3D " + i); > System.err.println("Test failed"); > } > } > } > ----------------- > Run this test several times. > java -Xmx64M fragTest > On RI output always is the following: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =3D 44000000 > DRLVM output: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Fo= undation or its licensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn =3D 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 =3D 39269205 i =3D 50083 > Test failed > Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Fo= undation or its licensors, as applicable. > java version "1.5.0" > pre-alpha : not complete or compatible > svn =3D 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 te= st suite (http://issues.apache.org/jira/browse/HARMONY-3536) --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.