From 933d5b7505e1357af6c32eda7fbbfd620c02fa64 Mon Sep 17 00:00:00 2001 From: Matt McClaskey Date: Thu, 1 Feb 2024 18:23:50 -0500 Subject: [PATCH] KASM-5563 limit secondary screen rect buffer size (#95) Co-authored-by: mattmcclaskey --- core/display.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/display.js b/core/display.js index 25f4dcc8..80d4b161 100644 --- a/core/display.js +++ b/core/display.js @@ -899,6 +899,11 @@ export default class Display { break; } this._syncFrameQueue.push(rect); + + //if the secondary display is not in focus, the browser may not call requestAnimationFrame, thus we need to limit our buffer + if (this._syncFrameQueue.length > 500) { + this._syncFrameQueue.pop(); + } break; case 'frameComplete': window.requestAnimationFrame( () => { this._pushSyncRects(); });