javascript ÄÚ´æй¶¹¤¾ßʹÓÃ
javascriptÄÚ´æ鶵ÄÎÊÌâÒ»Ö±ÒÔÀ´¶¼²»Êܵ½´ó¼ÒµÄÖØÊÓ£¬ÔÒòÊǶÔÓû§µÄÓ°ÏìûÓÐ̫ʵ¼ÊµÄ±íÏÖ£¬»òÐí½ü¼¸ÄêÄڴ淢չѸËÙ¡£½Å±¾ÄÚ´æÔÙй¶Ҳ²»»áÓÐÌ«´óÓ°Ïì¡£
µ±È»×÷Ϊǰ¶Ë¿ª·¢µÄͬѧÃÇ£¬¾Í²»ÄÜÓÐÕâÑùµÄ½ÄÐÒÐÄÀí¡£³öÏÖmemory leaksºÜ´ó³Ì¶ÈÉÏÊÇÒòΪ³ÌÐòµÄ²»³ÉÊìºÍ±àÂ벻̫¹æ·¶Ôì³ÉµÄ¡£²»¹ý£¬ÕâÀï¾Í²»ËµÈçºÎ³öÏÖÎÊÌâµÄ£¬¶ÔÎÊÌâµÄ³öÏÖÓÐÐËȤ¿ÉÒԲο¼ÒÔϵØÖ·£º
Understanding and Solving Internet Explorer Leak Patterns
IE's memory-leak fix greatly exaggerated
Memory Leakage in Internet Explorer – revisited
ÕâÀïÖ÷Ҫ˵˵£¬Ä¿Ç°¼¸¸ö¼ì²é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ÏÂÔصØÖ·:
http://home.orange.nl/jsrosman/
2. Javascript Leaks Detector
ÕâÊÇÀ´×Ô΢ÈíGPDEÍŶӵÄÒ»¸öС¹¤¾ß,ÏÂÃæ¼ò³ÆJLD
¹ÙÍø: http://blogs.msdn.com/gpde/pages/javascript-memory-leak-detector.aspx
°²×°ºó£¬ÎÒÃÇ¿ÉÒÔÔÚieä¯ÀÀÆ÷µÄ ²é¿´->ä¯ÀÀÆ÷À¸ÖÐÕÒµ½
JLDÇ
Ïà¹ØÎĵµ£º
×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ÍÊÇÓÃ×îͨË×µÄÎÄ×Ö½Ò¿ªJavascript±Õ°üµÄÕæʵÃæÄ¿¡£
Ò»¡¢Ê²Ã´ÊDZհü£¿
“¹Ù·½”µÄ½âÊÍÊÇ£ºËùν“±Õ°ü”£¬Ö¸µÄÊÇÒ»¸öÓµÓÐÐí¶à±äÁ¿ºÍ°ó¶¨Á ......
ʵÏÖ·½Ê½
ÕâÀï¸ø³ö2ÖÐʵÏÖ·½Ê½¡£Ò»ÖÖÊÇ´ó¼ÒÓ¦¸Ã¶¼ÖªµÀµÄindexOf¼ì²âµÄ·½Ê½£¬ÁíÒ»ÖÖÊǽáºÏlastIndexOfºÍspliceʵÏÖ·½Ê½¡£
//Ê×ÏȸøArray¶ÔÏóÔÐÍÉÏÌí¼ÓindexOfºÍlastIndexOf·½·¨.(Èç¹ûûÓеĻ°)
if(!Array.prototype.indexOf){
Array.prototype.indexOf = function(element, index){
var length = this.len ......
JavaScriptÊÇÓÉNetscape¹«Ë¾¿ª·¢²¢ËæNavigatorµ¼º½ÕßÒ»Æð·¢²¼µÄ¡¢½éÓÚJava
ÓëHTMLÖ®¼ä¡¢»ùÓÚ¶ÔÏóʼþÇý¶¯µÄ±à³ÌÓïÑÔ£¬ÕýÈÕÒæÊܵ½È«ÇòµÄ¹Ø×¢¡£ÒòËüµÄ¿ª·¢»·¾³¼òµ¥£¬²»ÐèÒªJava±àÒëÆ÷£¬¶øÊÇÖ±½ÓÔËÐÐÔÚWebä¯ÀÀÆ÷ÖУ¬¶øÒò±¶
ÊÜWebÉè¼ÆÕßµÄËù°®¡£
ÕâÒ»Ì×JavaScript½Ì³Ì·Ö¾Å¸öÕ½ڴÓʲôÊÇJavaScript¡¢JavaScriptµÄ¼òµ¥Ó¦ÓÃÒ»Ö ......
FlexÓëJavascript»¥ÏàͨÐÅ¡£
ÔÚFlexÖÐÓÐÕâôһ¸öÀࣺExternalInterface.ÔÚÕâ¸öÀàÖÐËü¸øÎÒÃÇ£ºcallºÍaddCallback
FlexÖÐAsµ÷ÓÃJsµÄ·½·¨ÊÇ£º
1¡¢µ¼Èë°ü £¨import flash.external.ExternalInterface;£©
2¡¢Ê¹ÓÃExternalInterface.call("Jsº¯ÊýÃû³Æ",²ÎÊý)½øÐе÷Óã¬Æä· ......