View Full Version : Memory leak?

08-28-2009, 03:26 PM
I'm newbie to Bing map. Recently when we tried to develop a product, we found the VE map has serious memory leak with IE. Following is a simple test page. The code initializes a map, using javascript to shift the longitude and reload the map. Every shift I try to dispose the map. But it seems no matter I dispose the map object or not, the IE memory usage just keeps up. :helpsmilie:

Does anyone have any idea how to fix this?

Thanks a lot.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MyTestVE.aspx.cs" Inherits="MyTestVE" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2"></script>
<script type="text/javascript">
var mapCenter;
var mapZoom;
var mapStyle;
var map;
function OnPageLoad()

function showMap(lat,lng)
map = new VEMap('myMap');
map.LoadMap(new VELatLong(lat,lng),10,VEMapStyle.Road, false, VEMapMode.Mode2D, false, 0, false);
function changeMap()
if(map && map!=null)
mapCenter = map.GetCenter();
mapZoom = map.GetZoomLevel();
mapStyle = map.GetMapStyle();
map = new VEMap('myMap');
map.LoadMap(new VELatLong(mapCenter.Latitude,mapCenter.Longitude+0 .25),mapZoom,mapStyle, false, VEMapMode.Mode2D, false, 0, false);
<body onload="OnPageLoad();">
<div id="myMap" style="position:relative;width:1000px;height:800px;"></div>
<div id="myform">
<form id="form1" runat="server">
<input type="button" value="Go" onclick="changeMap()" />