title: Garbage Collection and jQuery?
body: <p>How does jQuery (JavaScript) and gc work?</p>
  
  <p>callBack is a function that runs as a callback to a JSON response.</p>
  
  <p>What will be in memory when the callBack function has executed?</p>
  
  <p>What I would like to hear is that the data object and the <code>autoCompleteData</code> will be garbage collected. And only the data stored in <code>$("input#reciever")</code> resides in the memory. </p>
  
  <p>Is this the case?</p>
  
  <pre><code>//The code in question:
  
  var callBack = function(data) {
      var autoCompleteData = jQuery.map(data.receivers, function(receiver, i){
            return {label: receiver.name, id: receiver.id };
      });
  
      $("input#reciever").autocomplete({
          source: autoCompleteData,
          select: function(event, receiver) {
              $("input#reciever").val(receiver.item.label); 
              $("input#recieverId").val(receiver.item.id);
              return false;
          }
  
      });
  }
  </code></pre>