public static boolean checkBufRefs(final ValueVector vv) {
    for (final DrillBuf buffer : vv.getBuffers(false)) {
      if (buffer.refCnt() <= 0) {
        throw new IllegalStateException("zero refcount");
      }
    }

    return true;
  }
 /**
  * Helper method to check if the buffer we are accessing has a minimum reference count and has not
  * been deallocated
  *
  * @param b working drill buffer
  */
 private void checkBuf(DrillBuf b) {
   if (b.refCnt() < 1) {
     throw new IllegalStateException("Cannot access a dereferenced buffer.");
   }
 }