Return-Path: Delivered-To: apmail-ibatis-dev-archive@www.apache.org Received: (qmail 93799 invoked from network); 24 Dec 2009 00:39:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 24 Dec 2009 00:39:05 -0000 Received: (qmail 58263 invoked by uid 500); 24 Dec 2009 00:39:04 -0000 Delivered-To: apmail-ibatis-dev-archive@ibatis.apache.org Received: (qmail 58206 invoked by uid 500); 24 Dec 2009 00:39:04 -0000 Mailing-List: contact dev-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ibatis.apache.org Delivered-To: mailing list dev@ibatis.apache.org Received: (qmail 58198 invoked by uid 99); 24 Dec 2009 00:39:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Dec 2009 00:39:04 +0000 X-ASF-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 24 Dec 2009 00:38:55 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1NNbis-000775-8c for dev@ibatis.apache.org; Wed, 23 Dec 2009 16:38:34 -0800 Message-ID: <26909258.post@talk.nabble.com> Date: Wed, 23 Dec 2009 16:38:34 -0800 (PST) From: Dan Forward To: dev@ibatis.apache.org Subject: Re: SoftCacheTest is Failing In-Reply-To: <2f55db670912231521s2f2acab7o61d6f254cee33ea6@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: dan-nabble@forwardhome.com References: <26905687.post@talk.nabble.com> <2f55db670912231521s2f2acab7o61d6f254cee33ea6@mail.gmail.com> Subversion ------------------------------------------------------------ URL: http://svn.apache.org/repos/asf/ibatis/java/ibatis-3/trunk Revision: 893634 Last Changed Author: cbegin Last Changed Rev: 893558 Last Changed Date: 2009-12-23 09:01:16 -0700 (Wed, 23 Dec 2009) ------------------------------------------------------------ Java ------------------------------------------------------------ java version "1.6.0_15" Java(TM) SE Runtime Environment (build 1.6.0_15-b03) Java HotSpot(TM) 64-Bit Server VM (build 14.1-b02, mixed mode) -vmargs -Xms256m -Xmx2048m -XX:MaxPermSize=3D512m ------------------------------------------------------------ OS ------------------------------------------------------------ Linux host 2.6.31-16-generic #53-Ubuntu SMP Tue Dec 8 04:02:15 UTC 2009 x86_64 GNU/Linux (Ubuntu 9.10 64-bit) ------------------------------------------------------------ nmaves wrote: >=20 > Dan, >=20 > What release did you check out? What does your env look like? OS? > Java version? >=20 > I have not seen a test failing in any of the beta builds. >=20 > Nathan >=20 > On Wed, Dec 23, 2009 at 11:30 AM, Dan Forward > wrote: >> >> I just checked out the latest code for iBATIS 3 and discovered that a >> unit >> test fails while building. >> >> ------------------------------------------------------------ >> Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 5.006 se= c >> <<< FAILURE! >> shouldDemonstrateObjectsBeingCollectedAsNeeded(org.apache.ibatis.cache.S= oftCacheTest) >> Time elapsed: 4.96 sec =C2=A0<<< FAILURE! >> java.lang.AssertionError: >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.junit.Assert.fail(Assert.java:71) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.junit.Assert.assertTrue(Assert.java:34= ) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at org.junit.Assert.assertTrue(Assert.java:43= ) >> =C2=A0 =C2=A0 =C2=A0 =C2=A0at >> org.apache.ibatis.cache.SoftCacheTest.shouldDemonstrateObjectsBeingColle= ctedAsNeeded(SoftCacheTest.java:21) >> ------------------------------------------------------------ >> >> It seems that this test attempts to fill the cache beyond the limits of >> available memory, then checks whether the size of the cache is smaller >> than >> the number of items added. The cache is filled with 300,000 byte arrays >> that >> are 5001 bytes in size. >> >> I set the limit to 3,000,000 and told the loop to break as soon as the >> size >> of the cache was less than the number entered, and discovered that it >> happened after 326,315 entries and approximately 6 seconds on my machine= . >> The test I used is below. >> >> @Test >> public void shouldDemonstrateObjectsBeingCollectedAsNeeded() throws >> Exception { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0final int N =3D 3000000; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0SoftCache cache =3D new SoftCache(new Perpetu= alCache("default")); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (int i =3D 0; i < N; i++) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0byte[] array =3D new byte[5001]; //was= te a bunch of memory >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0array[5000] =3D 1; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0cache.putObject(i, array); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Object value =3D cache.getObject(i); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (cache.getSize() < i + 1) { >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0System.out= .println("Cache exceeded with " + (i + 1) + " >> entries."); >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0break; >> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >> =C2=A0 =C2=A0 =C2=A0 =C2=A0assertTrue(cache.getSize() < N); >> } >> >> -- >> View this message in context: >> http://old.nabble.com/SoftCacheTest-is-Failing-tp26905687p26905687.html >> Sent from the iBATIS - Dev mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org >> For additional commands, e-mail: dev-help@ibatis.apache.org >> >> >=20 > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org > For additional commands, e-mail: dev-help@ibatis.apache.org >=20 >=20 >=20 --=20 View this message in context: http://old.nabble.com/SoftCacheTest-is-Failin= g-tp26905687p26909258.html Sent from the iBATIS - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ibatis.apache.org For additional commands, e-mail: dev-help@ibatis.apache.org