From 661d94f995cde462a16696f30ab42739d66e173f Mon Sep 17 00:00:00 2001 From: Hugh Cunningham <57735705+hughy@users.noreply.github.com> Date: Wed, 3 Jul 2024 09:57:02 -0700 Subject: [PATCH] stops scanState meter on scan completion (#5108) when started the Meter class sets an interval to update its underlying arrays. if the meter is not stopped then this interval will keep running and keep the meter in the heap and leaks the meter memory. the WalletScanner creates a new ScanState and a new Meter for each scan. when the wallet is at the head of the chain this creates a new scan each time a block is added. fixes the memory leak by ensuring that the ScanState Meter is stopped when the scan completes and its interval function is cleared --- ironfish/src/wallet/scanner/scanState.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/ironfish/src/wallet/scanner/scanState.ts b/ironfish/src/wallet/scanner/scanState.ts index 2d4864ec84..eda13da0a5 100644 --- a/ironfish/src/wallet/scanner/scanState.ts +++ b/ironfish/src/wallet/scanner/scanState.ts @@ -51,6 +51,7 @@ export class ScanState { } signalComplete(): void { + this.speed.stop() this.runningResolve() }