Skip to content

Commit

Permalink
fix frames memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
sashankaryal committed Nov 26, 2024
1 parent 3b0ccf6 commit 7d5d7c6
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/packages/looker/src/lookers/frame-reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ interface AcquireReaderOptions {
export const { acquireReader, clearReader } = (() => {
const createCache = (removeFrame: RemoveFrame) => {
return new LRUCache<number, Frame>({
dispose: (_, key) => removeFrame(key),
dispose: (frame, key) => {
const overlays = frame.overlays;

for (let i = 0; i < overlays.length; i++) {
overlays[i].cleanup?.();
}

removeFrame(key);
},
max: MAX_FRAME_STREAM_SIZE,
maxSize: MAX_FRAME_STREAM_SIZE_BYTES,
noDisposeOnSet: true,
Expand Down

0 comments on commit 7d5d7c6

Please sign in to comment.