Hi,

Was trying to cut the memory leak reported with this tool ->
http://home.wanadoo.nl/jsrosman/.

Found out that there are some memory leaks in prototype's
Event.observe, only when the element that is observed is not within
the document DOM, this might happen when
1. I have not attached the element into the DOM, or that
2. I have removeChild or replaceChild the element that was observed
on. (this is what I encountered in my project)

I see this as a leak in prototype because using the attachEvent
(button 2 in the test page) equivalent does not present the same leak.

Attaching the element into the document (button 3 in the test page)
also does not present the same leak.

I have found that the fix from this thread ->
http://groups.google.com/group/prototype-core/browse_thread/thread/c2456d26913c7178/c478ad5df8ae9572?lnk=gst&q=memory+leak#c478ad5df8ae9572
solves the problem, contrary to the original poster who reported it
only for IE6, my test program shows that the leak happens for IE7 as
well.

For my project, instead of using the straight forward:
parent.replaceChild(newnode, oldnode);

I have to do this instead:
$(oldnode).select("*").each(function(e) {
  $(e).stopObserving();
});
parent.replaceChild(newnode, oldnode);

That's quite a lot of work.

Hope to see this fixed in 1.6.1 if not 1.6.0.

Cheers,
Phuah  Yee Keat

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Title: Testing prototype observe
Number of times:
Reload:
Leak:
Doesn't Leak:
Doesn't Leak:

Reply via email to