问题描述
从我想起一个不太遥远的过去,从内存时遇到循环引用泄漏问题遭受的Javascript间preters。
From what I recall of a not too distant past, Javascript interpreters suffered from memory leaking issues when faced with circular references.
这还算是在最新的浏览器的情况下? (例如铬,FF 3.5等)
Is it still the case in the latest browsers? (e.g. Chrome, FF 3.5 etc)
推荐答案
绝大多数泄漏我们谈论的JavaScript是专门在IE6-7当你JavaScript对象和像DOM节点主机对象之间的引用循环。
The vast majority of leaks we talk about with JavaScript are specifically in IE6-7 when you make a reference loop between JavaScript objects and host objects like DOM nodes.
在IE6这是特别有害的,当你离开这个页面你没有得到内存备用;它的消失,直到你退出浏览器。在IE7中清理出的页面确实现在回到记忆,但你仍然可以有困难,当你有一个长期运行的应用程序。 IE8解决大多数这个问题的正确转动DOM节点到本地JavaScript对象主机对象代替。 (您仍然可以被包括像一个参考循环ActiveX对象非原生对象触发IE8的泄漏。)
In IE6 this is particularly pernicious in that you don't get the memory back when you leave the page; it's gone until you quit the browser. In IE7 clearing out the page does now return the memory, but you can still have difficulty when you have a long-running application. IE8 solves most of this problem properly by turning the DOM nodes into native JavaScript objects instead of host objects. (You could still trigger the leaks in IE8 by including other non-native objects like ActiveX objects in a reference loop.)
有会肯定还是小不起眼的内存泄漏在随机的地方虎视眈眈的所有浏览器,尤其是在旧的版本。但有没有人能够轻松地分类,避免他们像在IE refloop问题的方式。
There will certainly still be small obscure memory leaks lurking around in random places for all the browsers, especially in older versions. But there's no one way to easily categorise and avoid them like with the IE refloop issue.
这篇关于JavaScript中,循环引用和内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!