/** * Allocate a new buffer that supports setting at least the provided number of * values. May actually be sized bigger depending on underlying buffer * rounding size. Must be called prior to using the ValueVector. * * Note that the maximum number of values a vector can allocate is * Integer.MAX_VALUE / value width. * * @param valueCount * @throws OutOfMemoryException * if it can't allocate the new buffer */ @Override public void allocateNew(final int valueCount) { allocateBytes(valueCount * VALUE_WIDTH); }
@Override public boolean allocateNewSafe() { long curAllocationSize = allocationSizeInBytes; if (allocationMonitor > 10) { curAllocationSize = Math.max(8, curAllocationSize / 2); allocationMonitor = 0; } else if (allocationMonitor < -2) { curAllocationSize = allocationSizeInBytes * 2L; allocationMonitor = 0; } try{ allocateBytes(curAllocationSize); } catch (DrillRuntimeException ex) { return false; } return true; }
/** * Allocate a new buffer that supports setting at least the provided number of * values. May actually be sized bigger depending on underlying buffer * rounding size. Must be called prior to using the ValueVector. * * Note that the maximum number of values a vector can allocate is * Integer.MAX_VALUE / value width. * * @param valueCount * @throws OutOfMemoryException * if it can't allocate the new buffer */ @Override public void allocateNew(final int valueCount) { allocateBytes(valueCount * VALUE_WIDTH); }
@Override public boolean allocateNewSafe() { long curAllocationSize = allocationSizeInBytes; if (allocationMonitor > 10) { curAllocationSize = Math.max(8, curAllocationSize / 2); allocationMonitor = 0; } else if (allocationMonitor < -2) { curAllocationSize = allocationSizeInBytes * 2L; allocationMonitor = 0; } try{ allocateBytes(curAllocationSize); } catch (DrillRuntimeException ex) { return false; } return true; }