D
dd
I have a situation where the browser memory goes up and up
as each Ajax call causes new content to be deployed into a
DIV. I'd like to know if I can force garbage collection to occur.
More detail:
My code is loaded in an iframe which is in a div. The parent
page looks like this (my code is in firstiframe.html):
<div id="main div">
some content that will get replaced via Ajax calls
</div>
<div id="abc">
<iframe src="firstiframe.html" bla bla>
</div>
What the parent page does is, each time the user clicks on
some menu that causes some Ajax function to load new
content into the "main div" (e.g. a webmail page and the
user clicks on an email to open it), then the parent page
loads the new content into that main div, and at the same
time, it loads a different iframe into the innerHTML of that
div "abc".
My job, in the code in the iframe, is to dynamically insert
things into the parent page. All those things I insert into
the parent page though, must be inside the "abc" div. What
I do is, get a handle to the iframe (e.g. parent.frames[0], or
parent.getElementsByTagName('iframe').item(myiframe))
and then I insertAdjacentElement("afterEnd",newelement).
So all divs and script elements I add, are encapsulated
within div "abc" and are therefore manageable by the
parent page. What it does is, when it's doing it's Ajax
pseudo-navigation, and just prior to loading a new iframe
into "abc", is to loop through the child nodes of "abc" and
remove all the elements. It's effectively nuking everything
I added. I don't have any control over how it's doing that,
it's nothing to do with me. It appears to work though.
The problem I've noticed though, is that memory just goes
up and up and up each time one of these pseudo navigations
occurs, leading me to think that although the nodes are
being removed, they're somehow hanging on. Perhaps it's an
issue with closures persisting, or setTimeout or setInterval
having a refcount on a function, or the ActiveX controls that
were on some of the DIV's that I inserted are still running.
If I could influence garbage collection (even if just manually
from the address bar as a test) then I could see if that helps.
I'm fairly limited in what I am able to do, but I do get to give
feedback to the authors of the code that "nukes" the "abc"
div contents and can advise them that it might be their fault
that memory is increasing. I'm not sure of this though, it
could easily be my fault.
I've thought about doing a test where I keep going and going
and seeing if the browser does eventually manage it's garbage
but haven't done that yet.
as each Ajax call causes new content to be deployed into a
DIV. I'd like to know if I can force garbage collection to occur.
More detail:
My code is loaded in an iframe which is in a div. The parent
page looks like this (my code is in firstiframe.html):
<div id="main div">
some content that will get replaced via Ajax calls
</div>
<div id="abc">
<iframe src="firstiframe.html" bla bla>
</div>
What the parent page does is, each time the user clicks on
some menu that causes some Ajax function to load new
content into the "main div" (e.g. a webmail page and the
user clicks on an email to open it), then the parent page
loads the new content into that main div, and at the same
time, it loads a different iframe into the innerHTML of that
div "abc".
My job, in the code in the iframe, is to dynamically insert
things into the parent page. All those things I insert into
the parent page though, must be inside the "abc" div. What
I do is, get a handle to the iframe (e.g. parent.frames[0], or
parent.getElementsByTagName('iframe').item(myiframe))
and then I insertAdjacentElement("afterEnd",newelement).
So all divs and script elements I add, are encapsulated
within div "abc" and are therefore manageable by the
parent page. What it does is, when it's doing it's Ajax
pseudo-navigation, and just prior to loading a new iframe
into "abc", is to loop through the child nodes of "abc" and
remove all the elements. It's effectively nuking everything
I added. I don't have any control over how it's doing that,
it's nothing to do with me. It appears to work though.
The problem I've noticed though, is that memory just goes
up and up and up each time one of these pseudo navigations
occurs, leading me to think that although the nodes are
being removed, they're somehow hanging on. Perhaps it's an
issue with closures persisting, or setTimeout or setInterval
having a refcount on a function, or the ActiveX controls that
were on some of the DIV's that I inserted are still running.
If I could influence garbage collection (even if just manually
from the address bar as a test) then I could see if that helps.
I'm fairly limited in what I am able to do, but I do get to give
feedback to the authors of the code that "nukes" the "abc"
div contents and can advise them that it might be their fault
that memory is increasing. I'm not sure of this though, it
could easily be my fault.
I've thought about doing a test where I keep going and going
and seeing if the browser does eventually manage it's garbage
but haven't done that yet.