mirror of https://github.com/apache/lucene.git
better memory estimate
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@476065 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb8fd8b8ce
commit
2b1dd87818
|
@ -1103,9 +1103,10 @@ public class MemoryIndex {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object header of any heap allocated Java object.
|
* 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
|
* Modern VMs tend to trade space for time, allocating memory on word
|
||||||
|
@ -1132,7 +1133,7 @@ public class MemoryIndex {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int sizeOfObject(int n) {
|
public static int sizeOfObject(int n) {
|
||||||
return sizeOf(HEADER + n);
|
return sizeOf(OBJECT_HEADER + n);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int sizeOfObjectArray(int len) {
|
public static int sizeOfObjectArray(int len) {
|
||||||
|
|
Loading…
Reference in New Issue