better memory estimate

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@475844 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Wolfgang Hoschek 2006-11-16 18:16:27 +00:00
parent 9a116a8b99
commit 34e917af03
1 changed files with 9 additions and 5 deletions

View File

@ -478,11 +478,15 @@ public class MemoryIndex {
}
private static boolean is64BitVM() {
int bits = Integer.getInteger("sun.arch.data.model", 0).intValue();
if (bits != 0) return bits == 64;
// fallback if sun.arch.data.model isn't available
return System.getProperty("java.vm.name").toLowerCase().indexOf("64") >= 0;
try {
int bits = Integer.getInteger("sun.arch.data.model", 0).intValue();
if (bits != 0) return bits == 64;
// fallback if sun.arch.data.model isn't available
return System.getProperty("java.vm.name").toLowerCase().indexOf("64") >= 0;
} catch (Throwable t) {
return false; // better safe than sorry (applets, security managers, etc.) ...
}
}
private int numPositions(ArrayIntList positions) {