diff --git a/packages/runtime-core/src/devtools.ts b/packages/runtime-core/src/devtools.ts index b26fae85d06..b5cbe30608a 100644 --- a/packages/runtime-core/src/devtools.ts +++ b/packages/runtime-core/src/devtools.ts @@ -53,6 +53,11 @@ export function setDevtoolsHook(hook: DevtoolsHook, target: any) { replay.push((newHook: DevtoolsHook) => { setDevtoolsHook(newHook, target) }) + // clear buffer after 3s - the user probably doesn't have devtools installed + // at all, and keeping the buffer will cause memory leaks (#4738) + setTimeout(() => { + buffer = [] + }, 3000) } }