0

I am working on a memory leak issue in the Internet explorer. This is a single paged application that is displayed on a large screen and refreshed every thirty minutes using javascript window.location.reload();. After every refresh the memory size keeps on increasing. I suspect cross page leak in the application. More about it here.

https://github.com/webcomponents/webcomponentsjs/issues/541 https://msdn.microsoft.com/en-us/library/bb250448(v=vs.85).aspx Javascript memory leak on page refresh; remedy?

But what I noticed was when I changed the code to window.location.reload(true); i.e hard refresh memory usage is normal and there is no memory leak.

Now my question is when I am using window.location.reload() is it that other than using the cached javascript, Internet explorer also keeps the leaked javascript objects from the previous page in the Internet explorer memory while when I am using window.location.reload(true) it not only gets fresh copies of the javascript files but clears any leaked objects held in the Internet explorer memory from the previous page. In short does hard refresh of a page affect the leaked objects held in Internet explorer memory related to that page.

Community
  • 1
  • 1
  • Just judging from what you've posted, it seems like the hard refresh does affect the leaked objects. It seems like you've nearly answered your own question. – James Kraus May 19 '17 at 16:08

2 Answers2

0

From the docs:

forcedReload Optional Is a Boolean flag, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.

When the page is forced to reload from the server, all page-specific objects in memory are destroyed.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
0

It's supposed to destroy all page-specific resources in memory that include JavaScript objects you mentioned in question title. Its behavior is documented in MDN as following:

window.location.reload(forcedReload);

forcedReload Is a Boolean flag, which, when it is true, causes the page to always be reloaded from the server. If it is false or not specified, the browser may reload the page from its cache.

but, IE 9 may have problems with such behavior as questioned here.

Community
  • 1
  • 1
hoangfin
  • 667
  • 7
  • 16