From 3536f7f7c27139e5cdec791f86bab4d1d5593e3a Mon Sep 17 00:00:00 2001 From: Ignacio Vera Date: Tue, 15 Sep 2020 08:34:22 +0200 Subject: [PATCH] Initialize BitArray storage as number of bits (#62327) (#62354) --- .../src/main/java/org/elasticsearch/common/util/BitArray.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/common/util/BitArray.java b/server/src/main/java/org/elasticsearch/common/util/BitArray.java index c7a2789f2f1..e938862a47c 100644 --- a/server/src/main/java/org/elasticsearch/common/util/BitArray.java +++ b/server/src/main/java/org/elasticsearch/common/util/BitArray.java @@ -34,11 +34,11 @@ public final class BitArray implements Releasable { /** * Create the {@linkplain BitArray}. - * @param initialSize the initial size of underlying storage. + * @param initialSize the initial size of underlying storage expressed in bits. */ public BitArray(long initialSize, BigArrays bigArrays) { this.bigArrays = bigArrays; - this.bits = bigArrays.newLongArray(initialSize, true); + this.bits = bigArrays.newLongArray(wordNum(initialSize) + 1, true); } /**