Author: burton
Date: Wed Mar  9 19:59:36 2005
New Revision: 156737

URL: http://svn.apache.org/viewcvs?view=rev&rev=156737
Log:
looks like I need 500 bytes of memory to to object overhead... need to thin 
that down...

Modified:
    
jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java

Modified: 
jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
URL: 
http://svn.apache.org/viewcvs/jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java?view=diff&r1=156736&r2=156737
==============================================================================
--- 
jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
 (original)
+++ 
jakarta/commons/sandbox/benchmark/trunk/src/test/org/apache/commons/benchmark/Test1.java
 Wed Mar  9 19:59:36 2005
@@ -38,6 +38,8 @@
 
     public void testMemory() throws Exception {
 
+        System.gc();
+        
         long before = Runtime.getRuntime().totalMemory() - 
Runtime.getRuntime().freeMemory();
 
         int count = 1000;
@@ -45,20 +47,25 @@
         for ( int i  = 0; i < count; ++i  ) {
 
             Benchmark b = Benchmark.getBenchmark( "foo:" + i );
+
             b.start();
             b.complete();
             
         }
 
+        System.gc();
+
         long after = Runtime.getRuntime().totalMemory() - 
Runtime.getRuntime().freeMemory();
 
-        //150k bytes is only 150 bytes per benchmark.  
-        assertTrue( after < 150 * count );
+        long usedMemory = after - before;
         
-        System.out.println( "total bytes used: " + (after-before) );
+        //500k bytes is only 500 bytes per benchmark.  
+        System.out.println( "Total bytes used by benchmark: " + usedMemory );
+
+        assertTrue( usedMemory < 500 * count );
 
         Benchmark.benchmarks = new HashMap();
-        
+        //Benchmark.benchmarks.clear();
     }
     
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to