javascript - JS 的循环引用, 原因是什么?
ringa_lee
ringa_lee 2017-04-10 12:45:39
0
5
876

Mozilla 文档上的例子, 这个是在 IE 6,7 里的,
https://developer.mozilla.org/en-US/docs/JavaScript/Memory_Management

var p = document.createElement("p");
p.onclick = function(){
  doSomething();
}; // The p has a reference to the event handler via its 'onclick' property
// The handler also has a reference to the p since the 'p' variable can be accessed within the function scope
// This cycle will cause both objects not to be garbage-collected and thus a memory leak.

这里说的, 函数里有一个对 p 的引用, 可是在哪, 是 this 么?
在 Chrome Firefox 里是否有类似的内存泄漏问题?
这是语言设计的失误么?

ringa_lee
ringa_lee

ringa_lee

全部回覆(5)
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!