title: How to remove / dispose a broadcast variable from heap in Spark?
body: <p>To broadcast a variable such that a variable occurs exactly once in memory per node on a cluster one can do: <code>val myVarBroadcasted = sc.broadcast(myVar)</code> then retrieve it in RDD transformations like so: </p>
  
  <pre><code>myRdd.map(blar =&gt; {
    val myVarRetrieved = myVarBroadcasted.value
    // some code that uses it
  }
  .someAction
  </code></pre>
  
  <p>But suppose now I wish to perform some more actions with new broadcasted variable - what if I've not got enough heap space due to the old broadcast variables?!  I want a function like</p>
  
  <pre><code>myVarBroadcasted.remove()
  </code></pre>
  
  <p>Now I can't seem to find a way of doing this.</p>
  
  <p>Also, a very related question: where do the broadcast variables go? Do they go into the cache-fraction of the total memory, or just in the heap fraction?</p>