Event Handler Assignment and Memory Leaks
<p>I understand the concept of circular references in JavaScript and the importance of avoiding them to prevent memory leaks, but I have not been able to find any information about how assigning functions that are members of closures or prototypes to event handlers impacts garbage collection.</p>

<p>For example...let's say I wrote either one of the following...</p>

<pre><code>var o = {};
o.var = 10000000;
o.func = function() { //Do something that does not involve o.var };

function p() { }
p.prototype.var = 100000;
p.prototype.func = function () { //Do something that does not involve p.var };
</code></pre>

<p>....and then proceeded to do either one of these...</p>

<pre><code>var div = document.getElementByID('div');
div.onclick = o.func;

var instance_of_p = new p();
var div = document.getElementByID('div');
div.onclick = instance_of_p.func;
</code></pre>

<p>Would the assignment of func() to a DOM event handler prevent the entire object from ever be collected by the GC?</p>
