I am using google's 3 Snapshot method to find memory leaks on the page. Page is running on Knockout.js and Jquery Mobile UI. I have already narrowed down to one of memory leaking divs. Between each snapshot I am running this script to clear the memory leaking object.
$('.paddedContentContainer').children().each(function(index,item){
console.log(item);
$(item).off();
ko.cleanNode($(item));
$(item).remove();
item = null;
});
.paddedContentContainer is parent of leaking object.
Now the interesting part is that I can still see object in retained object tree. In screenshot below you can see I am filtering on objects in Snapshot 3 that are retained from Snapshots 1 and 2, and by text it's visible that $0
from console in same object that is on the screen (Event Sales Order & ....).
I am assuming that .off();
and .remove();
isin't enough for object to be collected.
How to destroy all references to this object for good?