D
Daniel Orner
Hi all,
I've been trying to pin down a memory leak in IE6 for several WEEKS
now. I've done my share of googling etc., and know all about common
leaks like circular references and closures, but have found nothing like
this.
This app is designed to run in a kiosk environment, so it has
things like a persistent frame which holds data as well as the visible
frame (actually an iframe). After 1,000 page transitions our app is up
by almost 20MB; considering kiosks can run for days or even weeks this
is definitely not ideal. There's definitely a lot of stuff happening,
but I've managed to pin the leak down to a very odd case.
I have two identical test pages which I click between using a
navigate() function. I am absolutely sure that the tags in question have
their event handlers set to null before the page is navigated away from.
The following shows the leak (apologies, my news server disallows
HTML tags):
[a onmousedown="navigate('testPage2.html');"]CLICK ME[/a]
The following does NOT leak (there's a small leak but nowhere near
as much):
[a href='#' onmousedown="navigate('testPage2.html');"]CLICK ME[/a]
The following DOES leak:
[a onmousedown="location.href='#';navigate('testPage2.html');"]CLICK ME[/a]
Does anyone have any clue why this might be, ignoring the mass of
code that gets executed on page load/unload? Why would clicking that
link not leak only when there's an href assigned? Does that do something
weird to the event bubbling, perhaps? Or fire an extra event (or *not*
fire some other event)? And why wouldn't the magic also trip when
location.href is assigned via JavaScript?
Anyone who has any idea about this is invited to make my life a lot
happier. Thanks very much!
--Daniel Orner
I've been trying to pin down a memory leak in IE6 for several WEEKS
now. I've done my share of googling etc., and know all about common
leaks like circular references and closures, but have found nothing like
this.
This app is designed to run in a kiosk environment, so it has
things like a persistent frame which holds data as well as the visible
frame (actually an iframe). After 1,000 page transitions our app is up
by almost 20MB; considering kiosks can run for days or even weeks this
is definitely not ideal. There's definitely a lot of stuff happening,
but I've managed to pin the leak down to a very odd case.
I have two identical test pages which I click between using a
navigate() function. I am absolutely sure that the tags in question have
their event handlers set to null before the page is navigated away from.
The following shows the leak (apologies, my news server disallows
HTML tags):
[a onmousedown="navigate('testPage2.html');"]CLICK ME[/a]
The following does NOT leak (there's a small leak but nowhere near
as much):
[a href='#' onmousedown="navigate('testPage2.html');"]CLICK ME[/a]
The following DOES leak:
[a onmousedown="location.href='#';navigate('testPage2.html');"]CLICK ME[/a]
Does anyone have any clue why this might be, ignoring the mass of
code that gets executed on page load/unload? Why would clicking that
link not leak only when there's an href assigned? Does that do something
weird to the event bubbling, perhaps? Or fire an extra event (or *not*
fire some other event)? And why wouldn't the magic also trip when
location.href is assigned via JavaScript?
Anyone who has any idea about this is invited to make my life a lot
happier. Thanks very much!
--Daniel Orner