@Override public int[] getIntBlock() { int[] b = new int[IntBlockPool.INT_BLOCK_SIZE]; bytesUsed.addAndGet(IntBlockPool.INT_BLOCK_SIZE * Integer.BYTES); return b; }
@Override public byte[] getByteBlock() { if (freeBlocks == 0) { bytesUsed.addAndGet(blockSize); return new byte[blockSize]; } final byte[] b = freeByteBlocks[--freeBlocks]; freeByteBlocks[freeBlocks] = null; return b; }
@Override public int[] getIntBlock() { if (freeBlocks == 0) { bytesUsed.addAndGet(blockSize*Integer.BYTES); return new int[blockSize]; } final int[] b = freeByteBlocks[--freeBlocks]; freeByteBlocks[freeBlocks] = null; return b; }
@Override public void recycleByteBlocks(byte[][] blocks, int start, int end) { bytesUsed.addAndGet(-((end-start)* blockSize)); for (int i = start; i < end; i++) { blocks[i] = null; } } };
@Override public byte[] getByteBlock() { bytesUsed.addAndGet(blockSize); return new byte[blockSize]; }
@Override public void recycleIntBlocks(int[][] blocks, int offset, int length) { bytesUsed.addAndGet(-(length * (IntBlockPool.INT_BLOCK_SIZE * Integer.BYTES))); }
@Override public void run() { while (!stop) { // TODO: Use System.nanoTime() when Lucene moves to Java SE 5. counter.addAndGet(resolution); try { Thread.sleep( resolution ); } catch (InterruptedException ie) { throw new ThreadInterruptedException(ie); } } }
/** * Closes the BytesRefHash and releases all internally used memory */ public void close() { clear(true); ids = null; bytesUsed.addAndGet(Integer.BYTES * -hashSize); }
private void updateBytesUsed() { final long newBytesUsed = pending.ramBytesUsed(); iwBytesUsed.addAndGet(newBytesUsed - bytesUsed); bytesUsed = newBytesUsed; }
private void updateBytesUsed() { final long newBytesUsed = pending.ramBytesUsed() + pendingCounts.ramBytesUsed(); iwBytesUsed.addAndGet(newBytesUsed - bytesUsed); bytesUsed = newBytesUsed; }
@Override public int[] clear() { if (perField.postingsArray != null) { bytesUsed.addAndGet(-(perField.postingsArray.size * perField.postingsArray.bytesPerPosting())); perField.postingsArray = null; perField.newPostingsArray(); } return null; }
private void updateBytesUsed() { final long newBytesUsed = pending.ramBytesUsed() + docsWithField.ramBytesUsed(); iwBytesUsed.addAndGet(newBytesUsed - bytesUsed); bytesUsed = newBytesUsed; }
public PointValuesWriter(DocumentsWriterPerThread docWriter, FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; this.iwBytesUsed = docWriter.bytesUsed; this.bytes = new ByteBlockPool(docWriter.byteBlockAllocator); docIDs = new int[16]; iwBytesUsed.addAndGet(16 * Integer.BYTES); packedBytesLength = fieldInfo.getPointDataDimensionCount() * fieldInfo.getPointNumBytes(); }
@Override public int[] init() { if (perField.postingsArray == null) { perField.postingsArray = perField.createPostingsArray(2); perField.newPostingsArray(); bytesUsed.addAndGet(perField.postingsArray.size * perField.postingsArray.bytesPerPosting()); } return perField.postingsArray.textStarts; }
@Override public int[] grow() { ParallelPostingsArray postingsArray = perField.postingsArray; final int oldSize = perField.postingsArray.size; postingsArray = perField.postingsArray = postingsArray.grow(); perField.newPostingsArray(); bytesUsed.addAndGet((postingsArray.bytesPerPosting() * (postingsArray.size - oldSize))); return postingsArray.textStarts; }
private void updateBytesUsed() { final long newBytesUsed = lengths.ramBytesUsed() + bytes.ramBytesUsed() + docsWithField.ramBytesUsed(); iwBytesUsed.addAndGet(newBytesUsed - bytesUsed); bytesUsed = newBytesUsed; }
/** * Creates a new {@link BytesRefArray} with a counter to track allocated bytes */ public BytesRefArray(Counter bytesUsed) { this.pool = new ByteBlockPool(new ByteBlockPool.DirectTrackingAllocator( bytesUsed)); pool.nextBuffer(); bytesUsed.addAndGet(RamUsageEstimator.NUM_BYTES_ARRAY_HEADER * Integer.BYTES); this.bytesUsed = bytesUsed; }
private void updateBytesUsed() { final long newBytesUsed = pending.ramBytesUsed() + pendingCounts.ramBytesUsed() + docsWithField.ramBytesUsed() + RamUsageEstimator.sizeOf(currentValues); iwBytesUsed.addAndGet(newBytesUsed - bytesUsed); bytesUsed = newBytesUsed; }
public BinaryDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) { this.fieldInfo = fieldInfo; this.bytes = new PagedBytes(BLOCK_BITS); this.bytesOut = bytes.getDataOutput(); this.lengths = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT); this.iwBytesUsed = iwBytesUsed; this.docsWithField = new DocsWithFieldSet(); this.bytesUsed = lengths.ramBytesUsed() + docsWithField.ramBytesUsed(); iwBytesUsed.addAndGet(bytesUsed); }
public SortedSetDocValuesWriter(FieldInfo fieldInfo, Counter iwBytesUsed) { this.fieldInfo = fieldInfo; this.iwBytesUsed = iwBytesUsed; hash = new BytesRefHash( new ByteBlockPool( new ByteBlockPool.DirectTrackingAllocator(iwBytesUsed)), BytesRefHash.DEFAULT_CAPACITY, new DirectBytesStartArray(BytesRefHash.DEFAULT_CAPACITY, iwBytesUsed)); pending = PackedLongValues.packedBuilder(PackedInts.COMPACT); pendingCounts = PackedLongValues.deltaPackedBuilder(PackedInts.COMPACT); docsWithField = new DocsWithFieldSet(); bytesUsed = pending.ramBytesUsed() + pendingCounts.ramBytesUsed(); iwBytesUsed.addAndGet(bytesUsed); }