<div id="target">
...
</div>
$('#target').html('') will remove the content,but how to check if the listeners or anything else that holds memory is removed at the same time?
<div id="target">
...
</div>
$('#target').html('') will remove the content,but how to check if the listeners or anything else that holds memory is removed at the same time?
Standard JavaScript defines no means to instrument the interpreter's garbage collector, so I don't think this is possible.
However, since removing nodes is not an uncommon operation, I would not worry about browsers leaking memory in this case. Indeed as Piskvor said, the memory is probably not released immediately, but when the garbage collector eventually runs.
I am not sure how you can detect a leak within a javscript (using javacript). but there are tools available to detect the leaks in javscript
Cheers
Ramesh Vel