public long availableMemory() {
        lock.lock();
        try {
            return this.nonPooledAvailableMemory + freeSize() * (long) this.poolableSize;
        } finally {
            lock.unlock();
        }
    }
the total free memory both unallocated and in the free list
clients/src/main/java/org/apache/kafka/clients/producer/internals/BufferPool.java