From 4eb2e80094e19e3cf16b20a0e457073969384cd6 Mon Sep 17 00:00:00 2001 From: fgwt202412 <191263616+fgwt202412@users.noreply.github.com> Date: Sun, 15 Dec 2024 14:44:05 -0500 Subject: [PATCH] Release the buffer after encoding the message --- website/src/components/McapRecordingDemo/Recorder.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/website/src/components/McapRecordingDemo/Recorder.ts b/website/src/components/McapRecordingDemo/Recorder.ts index 27f78021d..fa751e0f6 100644 --- a/website/src/components/McapRecordingDemo/Recorder.ts +++ b/website/src/components/McapRecordingDemo/Recorder.ts @@ -309,13 +309,15 @@ export class Recorder extends EventEmitter { sample_rate: data.sampleRate, number_of_channels: data.numberOfChannels, }; + const encodedMsg = rootType.encode(msg).finish(); + data.release(); const now = this.#time(); await this.#writer.addMessage({ sequence, channelId: id, logTime: now, publishTime: now, - data: rootType.encode(msg).finish(), + data: encodedMsg, }); this.messageCount++; this.#emit();