Chrome编译代码 - 内存泄漏

时间:2016-07-22 09:22:43

标签: javascript google-chrome internet-explorer iframe memory-leaks

我试图在几个浏览器中找到内存泄漏。

实际的理论是,在我们的应用程序中,这种内存泄漏与iFrame结合在一起。我们使用这些来实现我们的webapp中的标签浏览等应用程序。

即使框架已关闭并移除,所有浏览器似乎都会保留内容。

在IE中私有字节不断增长(大约2/3的内存被清除,1/3在删除iFrame后仍然存在)但堆保持不变,在Chrome中我注意到(相同的)JavaScript源代码的编译代码保留。

我已经尝试将iFrames src设置为' about:blank'并清除iFrame中加载的所有内容:



[...]

purgeFrame(this.content[0]);
this.content.remove();

[...]

function purgeFrame (iFrame) {
	  $(iFrame.contentWindow.document).unbind();    //remove listeners on document
      $(iFrame.contentWindow.document).find('*').unbind(); //remove listeners on all nodes
      
      $(iFrame).attr('src', 'about:blank');
      
      iFrame.contentWindow.document.innerHTML = '';
      iFrame.contentWindow.document.write('');
      iFrame.contentWindow.close();
      
      $(iFrame).remove();
      
      if(typeof CollectGarbage == "function") {
          CollectGarbage();
      }
}




它并没有太大变化。 我们正在使用jQuery v1.12.4和其他一些框架,如DHTMLX 5.0.2。

对此类问题的任何建议或经验?

Memory Leak in Chrome

0 个答案:

没有答案