메모리 누수 문제로 몇일 동안 헤메던중에 발견한것인데,
가능할것도 같아서 발췌해서 링크 걸어요..
IE8 beta 에 적용해서 해보았습니다.
링크 거신곳으로 가보시면 더 많은 자료가 있드라구요..
주소 : http://www.hedgerwow.com/360/dhtml/ie6_memory_leak_fix/
핵심은
var obj = document.createElement("button");
.................
.................
try {
return obj;
} finally {
obj = null;
}
이것입니다..
/**
* Use the try ... finally statement to resolve the memory leak issue
*/
function createButton() {
var obj = document.createElement("button");
obj.innerHTML = "click me";
obj.onclick = function() {
//handle onclick
}
obj.onmouseover = function() {
//handle onmouseover
}
//this helps to fix the memory leak issue
try {
return obj;
} finally {
obj = null;
}
}
var dButton = document.getElementsById("d1").appendChild(createButton());
----------------------
링크
http://www.comefeel.com/tt/comefeel/357
http://msdn.microsoft.com/en-us/library/bb250448.aspx
http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx
'개발/활용정보 > Web (JavaScript, CSS, Xml)' 카테고리의 다른 글
URL Encoding Reference (0) | 2011.10.12 |
---|---|
JSP 페이지 이동 방법 (0) | 2011.04.19 |
html5 canvas (0) | 2011.04.19 |
IE Memory Leak (0) | 2011.04.13 |
JavaScript - 개체 지향 기술을 이용한 고급 웹 응용 프로그램 만들기 (0) | 2011.04.13 |