From a6d7bc2e569c97af93cbb90ceb04b78e5b640bf2 Mon Sep 17 00:00:00 2001 From: WofWca Date: Tue, 7 Sep 2021 06:54:02 +0300 Subject: [PATCH 1/2] fix: a memory leak appearing when some `timeSeries.disabled === true` Introduced in 86574e --- smoothie.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/smoothie.js b/smoothie.js index ad40ed5..178cdd4 100644 --- a/smoothie.js +++ b/smoothie.js @@ -910,18 +910,18 @@ // For each data set... for (var d = 0; d < this.seriesSet.length; d++) { - context.save(); var timeSeries = this.seriesSet[d].timeSeries; + + // Delete old data that's moved off the left of the chart. + timeSeries.dropOldData(oldestValidTime, chartOptions.maxDataSetLength); if (timeSeries.disabled) { continue; } + context.save(); var dataSet = timeSeries.data, seriesOptions = this.seriesSet[d].options; - // Delete old data that's moved off the left of the chart. - timeSeries.dropOldData(oldestValidTime, chartOptions.maxDataSetLength); - // Set style for this dataSet. context.lineWidth = seriesOptions.lineWidth; context.strokeStyle = seriesOptions.strokeStyle; From 85cb245f7c0df6660f6218a4416f0f2fde454cbb Mon Sep 17 00:00:00 2001 From: WofWca Date: Tue, 7 Sep 2021 07:11:05 +0300 Subject: [PATCH 2/2] docs: update changelog --- smoothie.js | 1 + 1 file changed, 1 insertion(+) diff --git a/smoothie.js b/smoothie.js index 178cdd4..9486b87 100644 --- a/smoothie.js +++ b/smoothie.js @@ -95,6 +95,7 @@ * Add title option, by @mesca * Fix data drop stoppage by rejecting NaNs in append(), by @timdrysdale * Allow setting interpolation per time series, by @WofWca (#123) + * Fix a memory leak appearing when some `timeSeries.disabled === true`, by @WofWca (#132) */ ;(function(exports) {