]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(devtools): clear devtools buffer after timeout
authorEvan You <yyx990803@gmail.com>
Thu, 7 Oct 2021 23:36:32 +0000 (19:36 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 7 Oct 2021 23:36:32 +0000 (19:36 -0400)
fix #4738

packages/runtime-core/src/devtools.ts

index b26fae85d06fa67cde7b66725d67f6cc07dae109..b5cbe30608a06113810740e3c4d77f5f76eab954 100644 (file)
@@ -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)
   }
 }