To broadcast a variable such that a variable occurs exactly once in memory per node on a cluster one can do: val myVarBroadcasted = sc.broadcast(myVar) then retriev
If you want to remove the broadcast variable from both executors and driver you have to use destroy, using unpersist only removes it from the executors: