I'm having memory leak problems with IE8 using the follow function:
function showAllSC(){
downloadUrl("xml/SCmarkers.php", function(data) {
xml = data.responseXML;
markers = xml.documentElement.getElementsByTagName("sc");
for (i = 0; i < markers.length; i++) {
label = markers[i].getAttribute("name");
if(typeof markersArraySC[""+markers[i].getAttribute("id")+""] !=
'undefined'){
markersArraySC[""+markers[i].getAttribute("id")
+""].setPosition(new
google.maps.LatLng(parseFloat(markers[i].getAttribute("latitude")),
parseFloat(markers[i].getAttribute("longitude"))));
}else{
markersArraySC[""+markers[i].getAttribute("id")+""] =
new
google.maps.Marker({
map: map,
position: new
google.maps.LatLng(parseFloat(markers[i].getAttribute("latitude")),
parseFloat(markers[i].getAttribute("longitude")))
});
bindSCCallback(markersArraySC[""+markers[i].getAttribute("id")
+""], markers[i].getAttribute("id"));
}
if(markers[i].getAttribute("tracking") == 1){
label = label+" - Tracking";
markersArraySC[""+markers[i].getAttribute("id")
+""].setIcon(SC_tracking);
markersArraySC[""+markers[i].getAttribute("id")
+""].setZIndex(3);
}else{
markersArraySC[""+markers[i].getAttribute("id")
+""].setIcon(SC);
markersArraySC[""+markers[i].getAttribute("id")
+""].setZIndex(2);
}
markersArraySC[""+markers[i].getAttribute("id")
+""].setTitle(label);
}
});
refreshAllSC = setTimeout(function(){showAllSC();},
refresh_allsc_interval);
};
This function takes every 10 seconds position of Spacecrafts and
update the position of the marker related to spacecraft. Problem is
that every time it create a new LatLon object for each spacecraft.
Reference of google maps API tells "Notice also that you cannot modify
the coordinates of a LatLng. If you want to compute another point, you
have to create a new one.". This is not a problem on Opera or firefox,
but it is on IE8 that seems doesn't do a good garbage collection.
Then there is a way to clear memory related to LatLon objects or to
reuse the old ones?
Sorry if may be a stupid question but it is the first time that I use
Javascript.
Thanks in advance,
Francesco
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.