public int allocateFromFreeListUnderLock(FreeList freeList, int freeListIx,
        MemoryBuffer[] dest, long[] destHeaders, int destIx, int destCount, int allocSize) {
      int current = freeList.listHead;
      assert (dest == null) != (destHeaders == null);
      while (current >= 0 && destIx < destCount) {
        int offset = offsetFromHeaderIndex(current), allocHeaderIx = current;
        current = getNextFreeListItem(offset);
        if (assertsEnabled) {
          checkHeader(allocHeaderIx, freeListIx, false);
        }
        if (dest != null) {
          LlapAllocatorBuffer buffer = (LlapAllocatorBuffer)dest[destIx];
          initializeNewlyAllocated(buffer, allocSize, allocHeaderIx, offset);
          setHeaderAlloc(allocHeaderIx, freeListIx, buffer, CasLog.Src.ALLOC_FREE_BUF);
        } else {
          destHeaders[destIx] = makeIntPair(arenaIx, allocHeaderIx);
          setHeaderNoBufAlloc(allocHeaderIx, freeListIx, CasLog.Src.ALLOC_FREE_DEFRAG);
        }
        ++destIx;
      }
      replaceListHeadUnderLock(freeList, current);
      return destIx;
    }
Unsets the headers (meaning this does not refer to a buffer).
llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java