Skip to content

Commit

Permalink
stops scanState meter on scan completion (#5108)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hughy committed Jul 8, 2024
1 parent d1d60a1 commit 661d94f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ironfish/src/wallet/scanner/scanState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class ScanState {
}

signalComplete(): void {
this.speed.stop()
this.runningResolve()
}

Expand Down

0 comments on commit 661d94f

Please sign in to comment.