You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by wh...@apache.org on 2006/11/17 08:29:45 UTC

svn commit: r476065 - /lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java

Author: whoschek
Date: Thu Nov 16 23:29:44 2006
New Revision: 476065

URL: http://svn.apache.org/viewvc?view=rev&rev=476065
Log:
better memory estimate

Modified:
    lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java

Modified: lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?view=diff&rev=476065&r1=476064&r2=476065
==============================================================================
--- lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/java/trunk/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Thu Nov 16 23:29:44 2006
@@ -1103,10 +1103,11 @@
     
     /**
      * Object header of any heap allocated Java object. 
-     * 1 word: ptr to class, 1 word: info for monitor, gc, hash, etc.
+     * ptr to class, info for monitor, gc, hash, etc.
      */
-    private static final int HEADER = 2*PTR; 
-        
+	private static final int OBJECT_HEADER = 2*4; // typically even on 64 bit VMs
+//  private static final int OBJECT_HEADER = 2*PTR; 
+
     /**
 	 * Modern VMs tend to trade space for time, allocating memory on word
 	 * boundaries. For example, on a 64 bit VM, the variables of a class with
@@ -1132,7 +1133,7 @@
     }
     
     public static int sizeOfObject(int n) {
-        return sizeOf(HEADER + n);        
+        return sizeOf(OBJECT_HEADER + n);        
     }
     
     public static int sizeOfObjectArray(int len) {