@Override public boolean allocateNewSafe() { boolean dataAlloc = false; try { allocateOffsetBuffer(offsetAllocationSizeInBytes); dataAlloc = vector.allocateNewSafe(); } catch (Exception e) { e.printStackTrace(); clear(); return false; } finally { if (!dataAlloc) { clear(); } } return dataAlloc; }
@Override public boolean allocateNewSafe() { /* boolean to keep track if all the memory allocation were successful * Used in the case of composite vectors when we need to allocate multiple * buffers for multiple vectors. If one of the allocations failed we need to * clear all the memory that we allocated */ boolean success = false; try { /* we are doing a new allocation -- release the current buffers */ clear(); /* allocate validity buffer */ allocateValidityBuffer(validityAllocationSizeInBytes); success = vector.allocateNewSafe(); } finally { if (!success) { clear(); return false; } } return true; }