db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r670017 - /db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/cache/ClassSize.java
Date Fri, 20 Jun 2008 18:19:23 GMT
Author: kmarsden
Date: Fri Jun 20 11:19:23 2008
New Revision: 670017

URL: http://svn.apache.org/viewvc?rev=670017&view=rev
Log:
DERBY-3731 Improve calculation of refSize in ClassSize.java

Add gc() before memory measurments to improve refSize calculation.


Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/cache/ClassSize.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/cache/ClassSize.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/cache/ClassSize.java?rev=670017&r1=670016&r2=670017&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/cache/ClassSize.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/cache/ClassSize.java Fri
Jun 20 11:19:23 2008
@@ -71,8 +71,12 @@
 
         // Figure out whether this is a 32 or 64 bit machine.
         Runtime runtime = Runtime.getRuntime();
+        runtime.gc();
+        runtime.runFinalization();
         long memBase = runtime.totalMemory() - runtime.freeMemory();
         Object[] junk = new Object[10000];
+        runtime.gc();
+        runtime.runFinalization();
         long memUsed = runtime.totalMemory() - runtime.freeMemory() - memBase;
         int sz = (int)((memUsed + junk.length/2)/junk.length);
         refSize = ( 4 > sz) ? 4 : sz;



Mime
View raw message