You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2020/01/15 08:51:01 UTC
[lucene-solr] branch master updated: LUCENE-9117: RamUsageEstimator
hangs with AOT compilation. Removed any attempt to estimate Long.valueOf
cache size: there will be some resulting overestimation but it shouldn't be
harmful.
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new 5677060 LUCENE-9117: RamUsageEstimator hangs with AOT compilation. Removed any attempt to estimate Long.valueOf cache size: there will be some resulting overestimation but it shouldn't be harmful.
5677060 is described below
commit 567706041d9b74c66144b99ce9668762aaf36319
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Wed Jan 15 09:50:51 2020 +0100
LUCENE-9117: RamUsageEstimator hangs with AOT compilation. Removed any attempt to estimate Long.valueOf cache size: there will be some resulting overestimation but it shouldn't be harmful.
---
lucene/CHANGES.txt | 3 +++
.../java/org/apache/lucene/util/RamUsageEstimator.java | 17 -----------------
.../org/apache/lucene/util/TestRamUsageEstimator.java | 2 --
3 files changed, 3 insertions(+), 19 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 8efdbe8..7a7122b 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -73,6 +73,9 @@ Bug fixes
* LUCENE-8663: NRTCachingDirectory.slowFileExists may open a file while
it's inaccessible. (Dawid Weiss)
+* LUCENE-9117: RamUsageEstimator hangs with AOT compilation. Removed any attempt to
+ estimate Long.valueOf cache size. (Cleber Muramoto, Dawid Weiss)
+
Other
* LUCENE-8768: Fix Javadocs build in Java 11. (Namgyu Kim)
diff --git a/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java b/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java
index 18d8ace..21f6c98 100644
--- a/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java
+++ b/lucene/core/src/java/org/apache/lucene/util/RamUsageEstimator.java
@@ -122,7 +122,6 @@ public final class RamUsageEstimator {
/**
* JVMs typically cache small longs. This tries to find out what the range is.
*/
- static final long LONG_CACHE_MIN_VALUE, LONG_CACHE_MAX_VALUE;
static final int LONG_SIZE, STRING_SIZE;
/** For testing only */
@@ -190,19 +189,6 @@ public final class RamUsageEstimator {
NUM_BYTES_ARRAY_HEADER = NUM_BYTES_OBJECT_HEADER + Integer.BYTES;
}
- // get min/max value of cached Long class instances:
- long longCacheMinValue = 0;
- while (longCacheMinValue > Long.MIN_VALUE
- && Long.valueOf(longCacheMinValue - 1) == Long.valueOf(longCacheMinValue - 1)) {
- longCacheMinValue -= 1;
- }
- long longCacheMaxValue = -1;
- while (longCacheMaxValue < Long.MAX_VALUE
- && Long.valueOf(longCacheMaxValue + 1) == Long.valueOf(longCacheMaxValue + 1)) {
- longCacheMaxValue += 1;
- }
- LONG_CACHE_MIN_VALUE = longCacheMinValue;
- LONG_CACHE_MAX_VALUE = longCacheMaxValue;
LONG_SIZE = (int) shallowSizeOfInstance(Long.class);
STRING_SIZE = (int) shallowSizeOfInstance(String.class);
}
@@ -230,9 +216,6 @@ public final class RamUsageEstimator {
* cached by the JVM and its shallow size otherwise.
*/
public static long sizeOf(Long value) {
- if (value >= LONG_CACHE_MIN_VALUE && value <= LONG_CACHE_MAX_VALUE) {
- return 0;
- }
return LONG_SIZE;
}
diff --git a/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java b/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java
index 8610afc..e4f05d8 100644
--- a/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java
+++ b/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java
@@ -208,8 +208,6 @@ public class TestRamUsageEstimator extends LuceneTestCase {
System.out.println("NUM_BYTES_OBJECT_HEADER = " + NUM_BYTES_OBJECT_HEADER);
System.out.println("NUM_BYTES_ARRAY_HEADER = " + NUM_BYTES_ARRAY_HEADER);
System.out.println("LONG_SIZE = " + LONG_SIZE);
- System.out.println("LONG_CACHE_MIN_VALUE = " + LONG_CACHE_MIN_VALUE);
- System.out.println("LONG_CACHE_MAX_VALUE = " + LONG_CACHE_MAX_VALUE);
}
@SuppressWarnings("unused")