The following function is called each second. The purpose is to update the last point on the polyline to follow a marker. The problem is, each time the code runs, the memory usage of the browser (CefSharp) increases by around 1 MB constantly, going from around 50 MB to over 200 MB in just a few minutes.
function moveMarker(lat, lon, hdg, followme) {
marker.setPosition(new google.maps.LatLng(lat, lng));
var len = traceLine.getPath().length;
traceLine.getPath().removeAt(len-1);
traceLine.getPath().push(marker.getPosition());
}
By removing the last three lines, the memory usage remains stable at around 53 MB.
The function running this code is invoked from C# using the following code:
String js = String.Format("moveMarker('{0}','{1}','{2}','{3}');",
lat.ToString(System.Globalization.CultureInfo.InvariantCulture),
lon.ToString(System.Globalization.CultureInfo.InvariantCulture), hdg,
followMeCb.Checked ? "true" : "false");
myChromiumWebBrowser.ExecuteScriptAsync(js);
Am I doing something totally wrong here?