From 8d8e3f410b899037ce776a3946c234d0feb01fe9 Mon Sep 17 00:00:00 2001 From: Matthias Wirth Date: Sun, 24 Jul 2022 09:02:37 +0200 Subject: [PATCH] fix releaseMem ... this time without flashing icons --- html/planeObject.js | 6 +++++- html/script.js | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/html/planeObject.js b/html/planeObject.js index 7848fd6..3cb1ffe 100644 --- a/html/planeObject.js +++ b/html/planeObject.js @@ -967,7 +967,7 @@ PlaneObject.prototype.updateIcon = function() { let styleKey = (webgl ? '' : svgKey) + '!' + labelText + '!' + this.scale; - if (this.styleKey != styleKey) { + if (this.styleKey != styleKey || !this.marker.getStyle()) { this.styleKey = styleKey; let style; if (labelText) { @@ -1667,10 +1667,14 @@ PlaneObject.prototype.clearMarker = function() { PlaneIconFeatures.removeFeature(this.marker); this.marker.visible = false; } + delete this.marker; if (this.glMarker && this.glMarker.visible) { webglFeatures.removeFeature(this.glMarker); this.glMarker.visible = false; } + delete this.glMarker; + delete this.styleKey; + delete this.olPoint; }; // Update our marker on the map diff --git a/html/script.js b/html/script.js index 948b2ce..6d1ee82 100644 --- a/html/script.js +++ b/html/script.js @@ -3395,14 +3395,15 @@ function removeHighlight() { // OpenLayers might have some slight memory retention issues // recreating all OpenLayers Features for the planes every now and then releases that retained memory function releaseMem() { + //console.log('releaseMem()'); for (let i in PlanesOrdered) { PlanesOrdered[i].clearMarker(); PlanesOrdered[i].destroyTrace(); PlanesOrdered[i].destroyTR(); } refreshFeatures(); - mapRefresh(true); TAR.planeMan.redraw(); + //mapRefresh(true); } function refreshFeatures() { @@ -7473,7 +7474,9 @@ function showReplayBar(){ function timeoutFetch() { fetchData(); timers.checkMove = setTimeout(timeoutFetch, Math.max(RefreshInterval, 10000)); - reaper(); + if (now - lastReap > 120) { + reaper(); + } } function handleVisibilityChange() {