Skip to content

Too many records cause memory leaks? #1497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
deot opened this issue Jun 29, 2021 · 1 comment
Open

Too many records cause memory leaks? #1497

deot opened this issue Jun 29, 2021 · 1 comment

Comments

@deot
Copy link

deot commented Jun 29, 2021

Memory tests after #1480 fixed
If it doesn't need optimization, close the issue directly!

Version

6.0.0-beta.15

Browser and OS info

Chrome 91 / Mac 11.4

Steps to reproduce

<template>
    <div style="padding: 20px">
        <div id="root" />
        <h1>{{ timer ? 'Running' : '----' }}</h1>
        <button @click="start">
            Start Test
        </button>
        <br>
        <br>
        <button @click="stop">
            Stop Test
        </button>
    </div>
</template>
<script>
import { createApp, defineComponent, h, ref, onUnmounted } from "vue";

export default defineComponent(() => {
    const timer = ref(null);
    const stop = () => {
        timer.value && clearInterval(timer.value);
        timer.value = null;
    };
    const start = () => {
        stop();
        timer.value = setInterval(
            () => {
                let vm = createApp(
                    () => Array
                        .from({ length: 1000 })
                        .map(() => h('div', { onClick: () => {} }))
                );
                vm.mount("#root");
                vm.unmount();
                vm = null;
            }, 
            10
        );
    };

    onUnmounted(stop);
    return {
        timer,
        start,
        stop
    };
});
</script>

What is expected?

Garbage collection

What is actually happening?

Memory Leak

Record Screen

  • Enable vue-devtools record
    Record Screen

  • Disable vue-devtools record
    Record without vue-devtools

@mazhewei
Copy link

I'm using vue dev tool beta(ver: 6.0.0 beta 15) with vue2.6.x。
And I meet some memory leak too.
Just create two pages, create a big array(100000 elements for example) in page1.
No keep-alive used.
goto page1, and then switch to page2,
You will see memory leak.
if disable the dev plugin, memory can be recycled.
I also test the old plugin for vue2, it works fine, no memory leak.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants