Avoiding memory leaks loading content into an iframe
I am working on an embedded system that presents content in an iframe. It
uses signalR (which is based on ajax) and jquery. The browser gets slower
and slower, and the memory usage goes up and up, as the hours go by. So I
am looking to remove all potential memory problems.
When the new page is loaded into the iframe, I attach click and focus
event handlers.
Just before the iframe page is to be replaced, I un-attach them.
However, if I inspect $.cache (while testing on a PC with firefox, so not
completely the same as my real system) it still shows $.cache gaining more
and more elements each time the iframe is reload.
Is this the correct way to do things? Is there anything else I can try?
Why is $.cache growing?
(In case your are interested I am using a raspberry pi (runs linux) with
the Midori browser, though there is a choice of other (mostly web-kit)
browsers that I could use).
Javascript I use to change the iframe contents...
hubProxy.client.loadPage = function (pageFilename, pageType) {
frameNode = $("#myIframe").contents();
$("a", frameNode).off();
$("#myIframe")[0].src = pageFilename;
};
No comments:
Post a Comment