public synchronized long releaseAllMemoryForTask(long taskAttemptId) {
        long numBytesToFree = memoryForTask.get(taskAttemptId);
        releaseMemory(numBytesToFree, taskAttemptId);
        return numBytesToFree;
    }
Release all memory for the given task and mark it as inactive (e.g. when a task ends).

@return the number of bytes freed.
indexr-query-opt/src/main/java/org/apache/spark/memory/MemoryManager.java