/// <summary> /// Creates a new <seealso cref="BytesRefHash"/> /// </summary> public BytesRefHash(ByteBlockPool pool, int capacity, BytesStartArray bytesStartArray) { HashSize = capacity; HashHalfSize = HashSize >> 1; HashMask = HashSize - 1; this.Pool = pool; Ids = new int[HashSize]; Arrays.Fill(Ids, -1); this.bytesStartArray = bytesStartArray; BytesStart = bytesStartArray.Init(); BytesUsed = bytesStartArray.BytesUsed() == null ? Counter.NewCounter() : bytesStartArray.BytesUsed(); BytesUsed.AddAndGet(HashSize * RamUsageEstimator.NUM_BYTES_INT); }
/// <summary> /// Creates a new <see cref="BytesRefHash"/> /// </summary> public BytesRefHash(ByteBlockPool pool, int capacity, BytesStartArray bytesStartArray) { hashSize = capacity; hashHalfSize = hashSize >> 1; hashMask = hashSize - 1; this.pool = pool; ids = new int[hashSize]; Arrays.Fill(ids, -1); this.bytesStartArray = bytesStartArray; bytesStart = bytesStartArray.Init(); bytesUsed = bytesStartArray.BytesUsed() ?? Counter.NewCounter(); bytesUsed.AddAndGet(hashSize * RamUsageEstimator.NUM_BYTES_INT32); }
/// <summary> /// Creates a new <see cref="RecyclingInt32BlockAllocator"/> with a block size of /// <see cref="Int32BlockPool.INT32_BLOCK_SIZE"/>, upper buffered docs limit of /// <see cref="DEFAULT_BUFFERED_BLOCKS"/>. /// </summary> public RecyclingInt32BlockAllocator() : this(Int32BlockPool.INT32_BLOCK_SIZE, 64, Counter.NewCounter(false)) { }
/// <summary> /// Creates a new <see cref="RecyclingInt32BlockAllocator"/>. /// </summary> /// <param name="blockSize"> /// The size of each block returned by this allocator. </param> /// <param name="maxBufferedBlocks"> /// Maximum number of buffered int blocks. </param> public RecyclingInt32BlockAllocator(int blockSize, int maxBufferedBlocks) : this(blockSize, maxBufferedBlocks, Counter.NewCounter(false)) { }
public DirectBytesStartArray(int initSize) : this(initSize, Counter.NewCounter()) { }
/// <summary> /// Creates a new <see cref="RecyclingByteBlockAllocator"/> with a block size of /// <see cref="ByteBlockPool.BYTE_BLOCK_SIZE"/>, upper buffered docs limit of /// <see cref="DEFAULT_BUFFERED_BLOCKS"/> (64). /// </summary> public RecyclingByteBlockAllocator() : this(ByteBlockPool.BYTE_BLOCK_SIZE, 64, Counter.NewCounter(false)) { }