Exemplo n.º 1
0
 /// <summary>
 /// Creates a new <see cref="BytesRefArray"/> with a counter to track allocated bytes
 /// </summary>
 public BytesRefArray(Counter bytesUsed)
 {
     this.pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator(bytesUsed));
     pool.NextBuffer();
     bytesUsed.AddAndGet(RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + RamUsageEstimator.NUM_BYTES_INT32);
     this.bytesUsed = bytesUsed;
 }
Exemplo n.º 2
0
 /// <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);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new <see cref="BytesRefHash"/>
 /// </summary>
 public BytesRefHash(ByteBlockPool pool)
     : this(pool, DEFAULT_CAPACITY, new DirectBytesStartArray(DEFAULT_CAPACITY))
 {
 }