From 2b1dd878186591c3343bd811dd0f3ee937c45b44 Mon Sep 17 00:00:00 2001 From: Wolfgang Hoschek Date: Fri, 17 Nov 2006 07:29:44 +0000 Subject: [PATCH] better memory estimate git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@476065 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/lucene/index/memory/MemoryIndex.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java b/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java index 9899d361461..dc293ec5f29 100644 --- a/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java +++ b/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java @@ -1103,10 +1103,11 @@ public class MemoryIndex { /** * 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 class MemoryIndex { } public static int sizeOfObject(int n) { - return sizeOf(HEADER + n); + return sizeOf(OBJECT_HEADER + n); } public static int sizeOfObjectArray(int len) {