RESOLVED INVALID 29093
[V8] HTML attribute listeners leak memory.
https://bugs.webkit.org/show_bug.cgi?id=29093
Summary [V8] HTML attribute listeners leak memory.
Vitaly Repeshko
Reported 2009-09-09 10:29:58 PDT
[V8] HTML attribute listeners leak memory. Creating DOM elements using innerHTML with listeners will leak memory in case these listeners are invoked at least once. function leak() { var node = document.createElement("span"); node.innerHTML = "<span onclick=''></span>"; node.childNodes[0].onclick(); // (*) } If you remove (*) line everything is back to normal. The cycle looks like this: C++ Span Element <---------------------- JS node wrapper | ^ v | V8LazyEventListener --[strong handle]--> JS function (onclick) The reference between JS function and JS wrapper gets created in V8LazyEventListener when it lazily compiles the function. This is very similar to http://crbug.com/17400 but with a different C++ listener type. This can be fixed like http://crbug.com/17400 by making the handle in V8LazyEventListener weak and adding a hidden dependency from JS wrapper to JS function to prevent the function from being collected.
Attachments
Test page to demonstrate the leak. (335 bytes, text/html)
2009-09-09 10:32 PDT, Vitaly Repeshko
no flags
Vitaly Repeshko
Comment 1 2009-09-09 10:32:07 PDT
Created attachment 39277 [details] Test page to demonstrate the leak.
Brian Burg
Comment 2 2014-12-16 00:48:28 PST
Closing some V8-related work items.
Note You need to log in before you can comment on or make changes to this bug.