Connecting Tech Pros Worldwide Forums | Help | Site Map

IE 7 memory leak when you remove an element from page, or Drip bug?

Sergei Shelukhin
Guest
 
Posts: n/a
#1: Oct 24 '07
Hi.
I have a <tdelement, with <ain it and <spaninside <a>, all
created statically (e.g. poresent in HTML when the page loads).
Later I execute the code that adds reference to td in question to a JS
object.
Then, when I remove TD from DOM tree, I set js object field to null.
When the page is unloaded the td leaks.

I tried all kinds of tircks but to no avail; what's more interesting
is that if you detach A from TD they both leak while A was never
referenced from anywhere in the first place!
THen, if you do not remove the TD from DOM tree and do everything else
the same way it doesn't leak too.
Currently I resorted to creating an invisible garbage div and moving
it there - it gets collected this way.

Could there be a bug w/ Drip showing that TD and A leaks?
Or if it's not a bug in Drip, why does it leak? Drip reference count
shows 5 for both TD and A; who the hell references them 5 times? 0_o


Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#2: Oct 24 '07

re: IE 7 memory leak when you remove an element from page, or Drip bug?


Please don't multi-post. http://en.wikipedia.org/wiki/Usenet

Sergei Shelukhin wrote:
Quote:
I have a <tdelement, with <ain it and <spaninside <a>,
Read like bad style.
Quote:
all created statically (e.g. poresent in HTML when the page loads).
Later I execute the code that adds reference to td in question to
a JS object.
Which code?
Quote:
Then, when I remove TD from DOM tree, I set js object field to null.
When the page is unloaded the td leaks.
Meaning what?
Quote:
[...]
Could there be a bug w/ Drip showing that TD and A leaks?
Who knows. What is Drip?

http://jibbering.com/faq/


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
David Mark
Guest
 
Posts: n/a
#3: Oct 24 '07

re: IE 7 memory leak when you remove an element from page, or Drip bug?


On Oct 24, 8:59 am, Sergei Shelukhin <realg...@gmail.comwrote:
Quote:
Hi.
I have a <tdelement, with <ain it and <spaninside <a>, all
created statically (e.g. poresent in HTML when the page loads).
Later I execute the code that adds reference to td in question to a JS
object.
Then, when I remove TD from DOM tree, I set js object field to null.
When the page is unloaded the td leaks.
Post a sample.
Quote:
>
I tried all kinds of tircks but to no avail; what's more interesting
is that if you detach A from TD they both leak while A was never
referenced from anywhere in the first place!
Post a sample.
Quote:
THen, if you do not remove the TD from DOM tree and do everything else
the same way it doesn't leak too.
Post a sample.
Quote:
Currently I resorted to creating an invisible garbage div and moving
it there - it gets collected this way.
Don't post that.
Quote:
>
Could there be a bug w/ Drip showing that TD and A leaks?
Yes. Drip is a derelict product with known issues.

Sergei Shelukhin
Guest
 
Posts: n/a
#4: Oct 25 '07

re: IE 7 memory leak when you remove an element from page, or Drip bug?


Hmm, [0]s are indeed required, I wonder why it didn't cause any
problems yet, thanks for noting it.
Quote:
It is hard to say without seeing the rest of this object, but I assume
it binds event handlers to the item elements at some point. You
likely need to set the event handler properties (e.g. onclick,
onmouseover) to null.
>
We use ASP.NET AJAX handlers and launch $clearHandlers on each object
when it's removed and then on all the remainng objects on unload.
If you remove the handlers completely, tho, td & a still leak.

David Mark
Guest
 
Posts: n/a
#5: Oct 25 '07

re: IE 7 memory leak when you remove an element from page, or Drip bug?


On Oct 25, 3:54 am, Sergei Shelukhin <realg...@gmail.comwrote:
Quote:
Hmm, [0]s are indeed required, I wonder why it didn't cause any
problems yet, thanks for noting it.
>
Quote:
It is hard to say without seeing the rest of this object, but I assume
it binds event handlers to the item elements at some point. You
likely need to set the event handler properties (e.g. onclick,
onmouseover) to null.
>
We use ASP.NET AJAX handlers and launch $clearHandlers on each object
Not from the looks of this code:

item.element.parentNode.removeChild(item.element);
item.element = null;
Quote:
when it's removed and then on all the remainng objects on unload.
If you remove the handlers completely, tho, td & a still leak.
According to Drip anyway. If you post a working example, perhaps I
can tell you if Drip is lying or not.


Closed Thread