javascript memory leaks
<p>i am using jquery and doing something like this</p>

<pre class="lang-html prettyprint-override"><code>    //dom
    &lt;div id="parent"&gt;
    &lt;/div&gt;
</code></pre>

<pre class="lang-js prettyprint-override"><code>    //js
    var _doSomeThing=function()
    {
    //some codes
    }

    $(function(){
//appending div and binding methods to span
    $('#parent').append('&lt;span&gt;1&lt;/span&gt;');
    $('#parent').append('&lt;span&gt;2&lt;/span&gt;');
    $('#parent span').bind('click',_doSomeThing);
    });

function _clearDiv()
{
//clear div
$('#parent').html('');
}

//sometime in future, call clear div
_clearDiv();
</code></pre>

<p>--
now my question is, binding events to dom and later just removing the elements from dom leads to memory leakage.
if yes how to solve this problem.</p>
