private void discardAllBuffersFromCtx(Arena arena, DiscardContext ctx) {
    for (int victimIx = 0; victimIx < ctx.victimCount; ++victimIx) {
      int victimHeaderIx = ctx.victimHeaders[victimIx];
      // Note: no location check here; the buffer is always locked for move.
      LlapAllocatorBuffer buf = arena.buffers[victimHeaderIx];
      if (buf == null) continue;
      if (assertsEnabled) {
        arena.checkHeader(victimHeaderIx, -1, true);
        byte header = arena.headers[victimHeaderIx];
        assertBufferLooksValid(freeListFromHeader(header), buf, arena.arenaIx, victimHeaderIx);
      }
      // We do not modify the header here; the caller will use this space.
      arena.buffers[victimHeaderIx] = null;
      long memUsage = buf.getMemoryUsage();
      Boolean result = buf.endDiscard();
      if (result == null) {
        ctx.memoryReleased += memUsage; // We have essentially deallocated this.
      } else if (result) {
        // There was a parallel deallocate; it didn't account for the memory.
        memoryManager.releaseMemory(memUsage);
      } else {
        // There was a parallel cache eviction - the evictor is accounting for the memory.
      }
    }
  }
Discards all the victim buffers in the context.
llap-server/src/java/org/apache/hadoop/hive/llap/cache/BuddyAllocator.java