我正在使用sIEve检查我的 ASP MVC 网站中的内存泄漏。sIEve 告诉我我的一个页面已经存在,但我不确定如何使用 sIEve 提供的信息来开始解决一些泄漏问题。
例如,在下面的屏幕截图中,我看到我的 ID 为“twitter-link”的 A 标签有泄漏,在我的代码中我有以下内容:
$("#twitter-link").click(function () {
$.cookie(cookieName, cookieValue);
popup("Twitter", "http://twitter.com/MyWebSite", 568, 1006);
});
function popup(source, url, height, width, callback) {
settings = {
height: 568, // sets the height in pixels of the window.
width: 1006, // sets the width in pixels of the window.
toolbar: 0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
scrollbars: 1, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
status: 0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
resizable: 1, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
left: 0, // left position when the window appears.
top: 0, // top position when the window appears.
center: 1, // should we center the window? {1 (YES) or 0 (NO)}. overrides top and left
createnew: 1, // should we create a new window for each occurance {1 (YES) or 0 (NO)}.
location: 0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
menubar: 0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
onUnload: null // function to call when the window is closed
};
if (settings.center == 1) {
if ($.browser.msie) {//hacked together for IE browsers
centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120) / 2) - (settings.height / 2)));
centeredX = window.screenLeft + ((((document.body.offsetWidth + 20) / 2) - (settings.width / 2)));
} else {
centeredY = window.screenY + (((window.outerHeight / 2) - (settings.height / 2)));
centeredX = window.screenX + (((window.outerWidth / 2) - (settings.width / 2)));
}
settings.top = centeredY; //(screen.height-(settings.height + 110))/2;
settings.left = centeredX; // (screen.width-settings.width)/2;
}
parameters = "location=" + settings.location + ",menubar=" + settings.menubar + ",height=" + settings.height + ",width=" + settings.width + ",toolbar=" + settings.toolbar + ",scrollbars=" + settings.scrollbars + ",status=" + settings.status + ",resizable=" + settings.resizable + ",left=" + settings.left + ",screenX=" + settings.left + ",top=" + settings.top + ",screenY=" + settings.top;
var popup = window.open(url, source, parameters);
var popuptimer = setInterval(function () {
if (popup.closed) {
clearInterval(popuptimer);
if (callback)
callback.call();
}
}, 1000);
}
<li><a id="twitter-link" href="javascript:void(0);"><img alt="Twitter" title="Twitter" src="twitter.png" />follow us on twitter</a></li>
我不明白“twitter-link”是如何导致泄漏的,所以我的问题是,如何使用 sIEve 提供的信息来消除泄漏?
在此先感谢您的帮助。