views:

130

answers:

2
<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?

+2  A: 

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.

intgr
+2  A: 

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

  • sIEve
  • IEJSLeaksDetector2.0.1.1

Cheers

Ramesh Vel

Ramesh Vel