码迷,mamicode.com
首页 > 其他好文 > 详细

内存泄漏

时间:2016-01-26 12:23:59      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

memory allocation :   object  创造时

memory free        :    当没有  reference 指向该object 时
 
当浏览器执行时,需要维护来自DOM的大量对象,IE使用自己的垃圾回收机制,而这个机制和javascript不同,这就导致内存泄漏的发生。
 
内存泄漏
A memory leak in JavaScript most commonly occurs when there are DOM nodes that are not reachable from the page’s DOM tree, but are still referenced by a JavaScript object. 
email.message = document.createElement(“div”);
displayList.appendChild(email.message);

And later, you remove the element from the display list:

 

displayList.removeAllChildren();

 

As long as

email
exists, the DOM element referenced by message will not be removed, even though it is now detached from the page’s DOM tree.

内存泄漏

标签:

原文地址:http://www.cnblogs.com/chuangweili/p/5159795.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!