javascript ÄÚ´æй¶¹¤¾ßʹÓÃ
javascriptÄÚ´æ鶵ÄÎÊÌâÒ»Ö±ÒÔÀ´¶¼²»Êܵ½´ó¼ÒµÄÖØÊÓ£¬ÔÒòÊǶÔÓû§µÄÓ°ÏìûÓÐ̫ʵ¼ÊµÄ±íÏÖ£¬»òÐí½ü¼¸ÄêÄڴ淢չѸËÙ¡£½Å±¾ÄÚ´æÔÙй¶Ҳ²»»áÓÐÌ«´óÓ°Ïì¡£
µ±È»×÷Ϊǰ¶Ë¿ª·¢µÄͬѧÃÇ£¬¾Í²»ÄÜÓÐÕâÑùµÄ½ÄÐÒÐÄÀí¡£³öÏÖmemory leaksºÜ´ó³Ì¶ÈÉÏÊÇÒòΪ³ÌÐòµÄ²»³ÉÊìºÍ±àÂ벻̫¹æ·¶Ôì³ÉµÄ¡£²»¹ý£¬ÕâÀï¾Í²»ËµÈçºÎ³öÏÖÎÊÌâµÄ£¬¶ÔÎÊÌâµÄ³öÏÖÓÐÐËȤ¿ÉÒԲο¼ÒÔϵØÖ·£º
ÕâÀïÖ÷Ҫ˵˵£¬Ä¿Ç°¼¸¸ö¼ì²éjavascriptÄÚ´æй¶µÄ¹¤¾ßʹÓ÷½·¨:
Ê×ÏÈÎÒÃÇÓõ½µÄ¹¤¾ßÓÐÈý¸ö Drip/sIEve ,Javascript Leaks Detector, leak monitor¡£ÆäÖÐÇ°Á½¸öÊÇÓÃÓÚ¼ì²éieµÄ£¬leak monitor ÊÇÓÃÀ´¼ì²éfirefoxµÄÇé¿öµÄ¡£ÕâÀïÖصã˵һÏÂieϵÄÕâÁ½¸ö¹¤¾ß£¬ÓÉÓÚfirefoxµÄGC»úÖƱÈieǿ׳£¬Ö»ÒªieµÄÎÊÌâÏû³ýÁË£¬ÆäËûä¯ÀÀÆ÷»ù±¾Éϲ»»áÓÐʲôÎÊÌâ¡£
1.Drip/sIEve
DripºÍsIEveµÄ×÷ÕßÓ¦¸ÃÊÇͬһ¸öÈË£¬Á¬open souceÉϵÄÏîÄ¿¶¼ÊÇÔÚÒ»ÆðµÄ¡£²»¹ý£¬Æ½Ê±ÎÒÃÇÖ÷ҪʹÓÃsIEve¾Í¿ÉÒÔÁË£¬sIEveµÄ¹¦ÄܱÈDripÇ¿´óһЩ
sIEve ½çÃæºÜ¼òµ¥£¬×ó²à£ºÄÚǶÁËÒ»¸öä¯ÀÀÆ÷¿Ø¼þ£¬ÎÒ¿ÉÒÔ·ÃÎÊÈκÎÍøÖ·£¬Ï·½»¹ÓиöÄÚ´æ¼ì²é£¬ÕâÑùÎÒÃÇ¿ÉÒÔ·½±ã¿´³öÄÚ´æµÄÉý½µÇé¿öÒÔ¼°domʹÓÃÊýÁ¿ÇúÏß¡£
ÓÒ²àÃæ°å£¬ÎÒÃÇ¿ÉÒÔͨ¹ý Show in use ¿´µ½Ä¿Ç°Ò³ÃæʹÓõÄdomµÄÇé¿ö£¬Show Leaks ¿ÉÒÔ¿´µ½ÄÚ´æ鶵Ädom¡£µ±È»Ã¿´ÎÏÔʾ鶵ÄÇé¿ö±ØÐëÊÇÒ³Ãæˢк󣬿´µ½ÉÏÒ»¸öÒ³ÃæµÄй¶Çé¿ö¡£
ͬʱͨ¹ýÓÒ²àµÄÊý¾ÝÑÕÉ«£¬ÎÒÃÇ¿ÉÒÔ¿´µ½ÄÚ´æµÄÉý½µºÍ¾ßÌåµÄÊýÁ¿¼¶
²»¹ýsIEveµÄ¹¤×÷ÔÀíÊǶÔËùÓÐdom½øÐÐÁËÒ»´Îhack,È»ºó×Ô¼ºÅжÏÄÇЩdomûÓб»Êͷŵô£¬µ«ÊǾßÌåµÄÇé¿ö±È½ÏÄÑ·ÖÎö³öÀ´¡£¶øÇÒ¸ú×ÙÓÐÎÊÌâµÄdomÐèÒªÒ»¶¨¼¼ÇÉ£¬¶ÔÓÚ´óÐ͵ÄÓ¦ÓóÌÐò£¬¸ú×ÙÄѶȴó¡£
²»¹ýÓÃÀ´¼ì²âСģ¿éµÄÄÚ´æʹÓÃÇé¿ö»¹ÊÇÒ»¸ö²»´íµÄÑ¡Ôñ£¬ÌرðÊÇ´óÏîÄ¿Ä£¿éϸ·Öºó£¬¶Ôÿ¸öÄ£¿éµÄµ¥¶À²âÊÔ»¹ÊDZȽϲ»´íµÄ
ллâø·ÉͬѧÌáʾµÄÏÂÔصØÖ·, Drip/sIEveÏÂÔصØÖ·:
2. Javascript Leaks Detector
ÕâÊÇÀ´×Ô΢ÈíGPDEÍŶӵÄÒ»¸öС¹¤¾ß,ÏÂÃæ¼ò³ÆJLD
¹ÙÍø: http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx
°²×°ºó£¬ÎÒÃÇ¿ÉÒÔÔÚieä¯ÀÀÆ÷µÄ ²é¿´->ä¯ÀÀÆ÷À¸ÖÐÕÒµ½
JLDÇ¿´óÖ®´¦ÔÚÓÚÄܹ»Ä£ÄâIE6ºÍIE7µÄGCÇé¿ö£¬ºÍÕæʵµÄ»ØÊÕÇé¿ö¡£ÕâÑù¿ÉÒÔ×öÒ»¸ö±È½Ï¡£
ÕâÀïͨ³£ÄÜÖ»ÄÜ·´Ó¦IE6ºÍIE7µÄÀíÏëÇé¿ö£¬ÎÒÃÇÐèҪѡÔñÏÂÃæActual LeaksÀ´·´Ó³µ±Ç°ä¯ÀÀÆ÷µÄÕæʵÇé¿ö¡£
ä¯ÀÀÆ÷ˢкó£
Ïà¹ØÎĵµ£º
ÀûÓÃJavascriptÏòÒ³ÃæÖвåÈëTABLE£¬IEÏÂÎÞ·¨Õý³£ÏÔʾ
¹Ø¼ü×Ö: table, appendchild, ie, firefox
ÔÚÏîÄ¿ÖÐżȻÓöµ½Ò»¸ö¹ÖÒìµÄÎÊÌ⣬ÎÒÒªÀûÓÃjavascript¶¯Ì¬µÄÏòÒ»¸öDIVÖвåÈëһЩ¸öTABLE£¬Firefox¿ÉÒÔÕý³£ÏÔʾ£¬¶øÔÚIEÏ£¬ÎÞÂÛ°æ±¾ÊÇ6»ò7£¬¾ùÎÞ·¨¿´µ½Õâ¸öTABLE¡£µ«ÊÇ£¬Èç¹ûÎÒÖ±½Ó°ÑTABLEµÄHTML´úÂëдÔÚÒ³ÃæÉÏ£¬Ò»Çж¼ÄÜÕý ......
ÔÌùURL: http://www.cnblogs.com/leadzen/archive/2008/02/25/1073404.html
Òý×Ó
±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂƵľÀ²øÖгÊÏÖ³öÎÞÏÞµÄÉú»úºÍ»îÁ¦¡£
Êý¾ÝÌìÉú¾ÍÊÇÎľ²µÄ£¬×ÜÏë±£³Ö×Ô¼º¹ÌÓеı¾É«£»¶ø´úÂëÈ´ ......
ÔÚÃæÏò¶ÔÏó±à³ÌÓïÑÔÖУ¬¶ÔÓÚthis¹Ø¼ü×ÖÎÒÃÇÊǷdz£ÊìϤµÄ¡£±ÈÈçC++¡¢C#ºÍJavaµÈ¶¼ÌṩÁËÕâ¸ö¹Ø¼ü×Ö£¬ËäÈ»ÔÚ¿ªÊ¼Ñ§Ï°µÄʱºò¾õµÃ±È½ÏÄÑ£¬µ«Ö»ÒªÀí½âÁË£¬ÓÃÆðÀ´ÊǷdz£·½±ãºÍÒâÒåÈ·¶¨µÄ¡£JavaScriptÒ²ÌṩÁËÕâ¸öthis¹Ø¼ü×Ö£¬²»¹ýÓÃÆðÀ´¾Í±È¾µäOOÓïÑÔÖÐÒª"»ìÂÒ"µÄ¶àÁË¡£
ÏÂÃæ¾ÍÀ´¿´¿´£¬ÔÚJavaScriptÖи÷ÖÖthisµÄʹÓ÷½·¨ÓÐʲô ......
1. document.write( " "); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document- >html- >(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window- >(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËصÄÃû³ÆºÍÖµ:document.getElementB ......
ÔÚ³ÌÐòÔ±ÔÓÖ¾ÉÏ¿´µ½Ò»Æª¶ÌÎÄ¡¶Ç°¶Ë¿ª·¢¹¤¾ß¸ÅÀÀ¡·¡£¾õµÃºÜÓÐʵÓüÛÖµ¡£ÏÖ×ܽáÈçÏ£º
Ò»¡¢µ÷ÊÔ¹¤¾ß
1.firebug
2.Web Developer Toolbar--µ÷ÕûÒ³ÃæµÄ¸÷¸öϸ½Ú
3.IE Developer Toolbar--µ÷ÊÔIEµÄHTMLºÍCSS
4.Companion.JS--µ÷ÊÔIEµÄJavascript
5.Fiddler--Webµ÷ÊÔ´úÀí£¬¼Ç¼±¾»úµ½»¥ÁªÍøµÄËùÓÐHTTP(S)ÇëÇó¡£
¶þ¡¢²âÊÔ¹¤ ......