Any action in Spark releases the data from memory once the DAG execution is completed. What this means is there'll be no references to that data anymore and the garbage collector will free up the memory.
action
DAG