咖啡伴侶

          呆在上海
          posts - 163, comments - 156, trackbacks - 0, articles - 2

          IE下 eval 內存泄漏

          Posted on 2012-08-15 16:53 oathleo 閱讀(1735) 評論(1)  編輯  收藏 所屬分類: Web
          下面2段代碼是測試代碼,IE9下測試
          都有泄漏,非IE瀏覽器沒問題。困惑


          每秒eval,400個方法調用;200多K的內存泄漏,

          <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
          <html>
              <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                  <title>eval 測試</title>
                  <script>

              
          var afunction = function(_name,_mask){
                   
          return false;
              }
              
              
          var bfunction = function(_color){
              }
              
              
          var cfunction = function(_color){
              }

          var _action = function(){

              
          for(var i=0;i<40;i++){
              
               
                   
          var _script = "if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00');";
                   _script 
          += "if(afunction('222','333')) cfunction('0xCDCD00'); else if(afunction('222','333')) cfunction('0xCDCD00');  else if(afunction('222','333')) cfunction('0xCDCD00'); else if(afunction('222','333')) cfunction('0xCDCD00'); else if(afunction('222','333')) cfunction('0xCDCD00');";
                   
          var _func = new Function(_script);
                    _func();
                  
              }
           
          }

          window.onload 
          = function() {
              setInterval(_action,
          1000);
          };

          </script>

              </head>
              <body>
                  
              </body>
          </html>
          2.



          <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
          <html>
              <head>
                  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                  <title>eval 測試</title>
                  <script>

          var _action = function(){

              
          var afunction = function(_name,_mask){
                   
          return false;
              }
              
              
          var bfunction = function(_color){
              }
              
              
          var cfunction = function(_color){
              }
              
              
          for(var i=0;i<40;i++){
                   
          var _script = "if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00'); else if(afunction('111','222')) bfunction('0xCDCD00');";
                   _script 
          += "if(afunction('222','333')) cfunction('0xCDCD00'); else if(afunction('222','333')) cfunction('0xCDCD00');  else if(afunction('222','333')) cfunction('0xCDCD00'); else if(afunction('222','333')) cfunction('0xCDCD00'); else if(afunction('222','333')) cfunction('0xCDCD00');";
                   eval(_script);
              }
           
          }

          window.onload 
          = function() {
              setInterval(_action,
          1000);
          };

          </script>

              </head>
              <body>
                  
              </body>
          </html>

          Feedback

          # re: IE下 eval 內存泄漏  回復  更多評論   

          2012-08-15 19:18 by 太陽山
          調用走先
          主站蜘蛛池模板: 常德市| 海林市| 清镇市| 玉田县| 区。| 永靖县| 新营市| 马尔康县| 九江市| 梓潼县| 四平市| 玉山县| 新绛县| 清新县| 高雄市| 乌兰浩特市| 永川市| 吴旗县| 富宁县| 正阳县| 嵊州市| 称多县| 柞水县| 勐海县| 鄯善县| 三原县| 宜昌市| 定襄县| 宣威市| 林甸县| 永善县| 舒兰市| 囊谦县| 合肥市| 鹤山市| 奇台县| 东阳市| 禹城市| 剑阁县| 文山县| 革吉县|