2012-05-18 2 views
1

IE 9에서 누출 된 것을 보여주는 예제 코드가 있습니다. (몇 분 안에 1Gb). 이 메모리 누출은 V3.8에서 V3.7으로 변경 될 때 발생하지 않습니다 !!! 그래서 내 생각에 v3.8에서 소개되었습니다! 코드는 Chrome/Firefox에서 작동하는 것으로 보이지만 C# Winform 앱 에서 작업하고 IE의 COM 래퍼 인 .NET. webcontrol을 사용합니다. 이미 gecko .NET 구성 요소를 사용해 보았습니다. 그러나 이것은 저를 대신 할 수 없습니다.구글 맵스 자바 스크립트 V3.8에서 메모리 누수가 발생했습니다 (IE 9에서 확인 됨)

내가 여기 필사적 붙어, 그래서 누군가가 솔루션을 제공하기 위해 너무 친절 될 경우입니다 ...

Thnx 롭

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> 
    <head> 
     <meta http-equiv="content-type" content="text/html; charset=utf-8" /> 
     <title>Memoryleak in IE</title> 

     <style type="text/css"> 
      html 
      { 
      } 
      body 
      { 
       margin: 0px; 
       padding: 0px; 
      } 

     </style> 
     <style type="text/css"> 
      .context 
      { 
       font-family: Arial, sans-serif; 
       text-decoration: none; 
       color: #4444ff; 
       font-size: small; 
      } 
      a:hover div 
      { 
       background: #00eeee; 
      } 
     </style> 

     <script src="https://maps.googleapis.com/maps/api/js?sensor=false&amp;v=3.8" type="text/javascript"></script> 
     <script type="text/javascript"> 

     var coords = [ 
    -115.821139332819,51.2247937004413, 
    -115.821139332819,51.2247937004413, 
    -115.820783024602,51.2247102926052, 
    -115.820783024602,51.2247102926052, 
    -115.820327685708,51.2246117850904, 
    -115.820327685708,51.2246117850904, 
    -115.819759388578,51.2244962798047, 
    -115.819759388578,51.2244962798047, 
    -115.819290270032,51.2244074438906, 
    -115.819290270032,51.2244074438906, 
    -115.818926957722,51.2243299769159, 
    -115.818926957722,51.2243299769159, 
    -115.818338387318,51.2242059504634, 
    -115.818338387318,51.2242059504634, 
    -115.817977304212,51.2241249042188, 
    -115.817977304212,51.2241249042188, 
    -115.817599143301,51.224042310143, 
    -115.817599143301,51.224042310143, 
    -115.817134937747,51.2239589216431, 
    -115.817134937747,51.2239589216431, 
    -115.816536085049,51.2238583513406, 
    -115.816536085049,51.2238583513406, 
    -115.816082549208,51.2237586568853, 
    -115.816082549208,51.2237586568853, 
    -115.815700862212,51.2236505400057, 
    -115.815700862212,51.2236505400057, 
    -115.815357631111,51.223555251529, 
    -115.815357631111,51.223555251529, 
    -115.814809515585,51.2234021852219, 
    -115.814809515585,51.2234021852219, 
    -115.814355814815,51.2232968327074, 
    -115.814355814815,51.2232968327074, 
    -115.813999142875,51.2231965005283, 
    -115.813999142875,51.2231965005283, 
    -115.813647699181,51.2230910623849, 
    -115.813647699181,51.2230910623849, 
    -115.813026822773,51.2229353329219, 
    -115.813026822773,51.2229353329219, 
    -115.812582641159,51.2228335929039, 
    -115.812582641159,51.2228335929039, 
    -115.812013680777,51.2226994808324, 
    -115.812013680777,51.2226994808324, 
    -115.811661976828,51.2225955792611, 
    -115.811661976828,51.2225955792611, 
    -115.811254131518,51.2224819086399, 
    -115.811254131518,51.2224819086399, 
    -115.810894380211,51.2223965803553, 
    -115.810894380211,51.2223965803553, 
    -115.810314308135,51.2222515485398, 
    -115.810314308135,51.2222515485398, 
    -115.809965253975,51.2221524009482]; 


     var myPano = null; 
     var mySVC = null; 
     var sv  = new google.maps.StreetViewService(); 
     var teller = 0; 
     var tmr = null; 

     function startStreetviewMode(lat, lon) 
     { 
      try 
      { 
       var svPanoramaOptions = { 
        visible:   true, 
        disableDoubleClickZoom: true, 
        linksControl:  true, 
        addressControl: true, 
        panControl:  true, 
        zoomControl:  false, 
        imageDateControl: false, 
        position:   new google.maps.LatLng(lat, lon), 
        pov: { 
         heading: 180, 
         pitch: 0, 
         zoom: 1 
         } 
        }; 

       myPano = new google.maps.StreetViewPanorama(document.getElementById("pano"), svPanoramaOptions); 
       myPano.setVisible(true); 

       svPanoramaOptions = null; 
      } 
      catch (err) 
      { 
       alert("startStreetviewMode, " + err.source + ':' + err.message); 
      } 
     } 

     function SVPanoInitialized(SVLocation) 
     { 
     } 

     function handleSVError(errorCode) 
     { 
     } 


     function showStreet(lat, lng) 
     { 
      try 
      { 
       sv.getPanoramaByLocation(new google.maps.LatLng(lat, lng), 50, function (data, status) 
       { 
        if (status == google.maps.StreetViewStatus.OK) 
        { 
         myPano.setPov({ 
          heading: 180, 
          pitch: 10, 
          zoom: 1 
         }); 
         myPano.setPano(data.location.pano); 
         myPano.setVisible(true); 
         data = null; 
         status = null; 
        } 
        else 
        { 
         handleSVError(status); 
        } 
       }); 
      } 
      catch (err) 
      { 
       alert("showStreet, " + err.source + ':' + err.message); 
      } 
     } 

     function showit() 
     { 
      // Keep looping through array 
      teller = teller + 2; 
      if (teller > 80) teller = 0; 

      // Show streetview to demonstrate leak 
      showStreet(coords[teller + 1], coords[teller]); 
     } 

     function init() 
     { 
      startStreetviewMode(coords[teller + 1], coords[teller]); 
      window.setInterval(this.showit, 750); 
    } 
    </script> 
    </head> 
    <body onload="init()"> 
     <div id="pano" style="width: 1024px; height: 768px" /> 
    </body> 
    </html> 

답변

0

범위가 지정되지 않은 (및 전역) 변수의 원인을 알고있다 메모리 누출. 모든 변수가 function-locals로 올바르게 범위가 지정되었는지 확인하는 것이 좋습니다.

+0

답변을위한 Thnx. 나는 더 많은 조사를했고 그것과 관련된 V3.8이라고 결론 지었다! –

관련 문제