Closed jfsiii closed 8 years ago
I tried it with h()
instead ( http://requirebin.com/?gist=4a0f6e2084efdd826cc6 ).
It looks like diff & patch do not leak.
The leak is probably here ( https://github.com/marcelklehr/vdom-virtualize/blob/9e2da942c787cd9f9c1c745f3a74a08d8158d471/index.js#L111-L112 ). I'm curious whether we are copying such properties as elem.firstChild
and elem.previousSibling
I guess that line's the problem. I just tried wrapping that value in a String(), but that didn't seem to help.
What's weird is that the nodes seems to be GC'd just fine the first few seconds for me, but then after about 6secs the count increases uncintrolled.
The list at the end of the file (props
) is the whitelist of all properties that are copied.
Mh. GC'ing manually works for me, so I think it's not a memory leak.
I tried window.virtualize.fromHTML('<h1>teste</h1')
and ir returns an html
and body
nodes with the h1
node inside. Is that necessary? Why dont return just the h1
node?
parsing HTML correctly is hard, so I've removed fromHTML and recommend using https://github.com/TimBeyer/html-to-vdom instead -- If you want HTML parsing, use that. If you already have a DOM tree, virtualize will probably be more performant.
Thanks!
See this RequireBin.
250+ nodes were created in ~10 seconds:
I believe this is because DOM nodes are continually created but not reused or removed.
Please let me know if you see something wrong with my test case.