当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - iframe content retained in node webkit

问题描述:

I'm making an app in Node-Webkit that shows different sites, videos and pictures after each other, where I show the images in an image-tag, the videos in a video-tag and the sites in an iframe-tag in an iframe, and I replace one with the other. The problem is that when I look in the chrome dev-tools, the Dom Node Count keeps increasing, as does the Document Count. It looks like when I replace an iframe with something else (an image or another website), it does not get removed from memory (memory also increases over time). The video and image tags don't have these leftovers.

This is a problem because it is supposed to run for a long timespan, and eventually this memory leak will kill the app.

What I do is basically this:

html:

<div id="content"></div>

js:

document.getElementById("content").innerHTML = "<iframe src='http://www.google.com' />";

and later

document.getElementById("content").innerHTML = "<video src='some.video.source' />";

but then when I look at the timeline in the nodes that were added when inserting the iframe are not removed.

Can anyone help me with how to clear the iframe (and it's content) ?

网友答案:

I am seeing the same issue, and believe it is caused by this issue: https://bugs.webkit.org/show_bug.cgi?id=31253

分享给朋友:
您可能感兴趣的文章:
随机阅读: