private void allocate(int capacity) {
        assert (capacity >= 0);
        capacity = Math.max((int) Math.min(MAX_CAPACITY, ByteArrayMethods.nextPowerOf2(capacity)), 64);
        assert (capacity <= MAX_CAPACITY);
        longArray = allocateArray(capacity * 2);
        longArray.zeroOut();

        this.growthThreshold = (int) (capacity * loadFactor);
        this.mask = capacity - 1;
    }
Allocate new data structures for this map. When calling this outside of the constructor,
make sure to keep references to the old data structures so that you can free them.

@param capacity the new map capacity
indexr-query-opt/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java