Skip to content

Apache Lucene open-source search software

LUCENE-5094: add ramBytesUsed to OrdinalMap

Robert Muir792bae8b26c7
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 8fe4219a12d..7736c778374 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -57,6 +57,11 @@ New features
* LUCENE-5098: New broadword utility methods in oal.util.BroadWord.
(Paul Elschot via Adrien Grand, Dawid Weiss)
+API Changes
+
+* LUCENE-5094: Add ramBytesUsed() to MultiDocValues.OrdinalMap.
+ (Robert Muir)
+
======================= Lucene 4.4.0 =======================
Changes in backwards compatibility policy
diff --git a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
index adc749ab6bb..c793516c802 100644
--- a/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
+++ b/lucene/core/src/java/org/apache/lucene/index/MultiDocValues.java
@@ -360,6 +360,17 @@ public class MultiDocValues {
public long getValueCount() {
return globalOrdDeltas.size();
}
+
+ /**
+ * Returns total byte size used by this ordinal map.
+ */
+ public long ramBytesUsed() {
+ long size = globalOrdDeltas.ramBytesUsed() + subIndexes.ramBytesUsed();
+ for (int i = 0; i < ordDeltas.length; i++) {
+ size += ordDeltas[i].ramBytesUsed();
+ }
+ return size;
+ }
}
/**