Skip to content

Operation input box,after leaving the page, the component data is not released #11600

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

Closed
hf0913 opened this issue Aug 17, 2020 · 1 comment
Closed

Comments

@hf0913
Copy link

hf0913 commented Aug 17, 2020

Version

2.6.11

Reproduction link

https://codesandbox.io/s/unruffled-night-t32t2?file=/src/router.js:253-257

code

<script src="https://cdn.jsdelivr.net/npm/vue"></script> <script src="https://unpkg.com/vue-router/dist/vue-router.js"></script> <title>input momery leak</title>
Go to input page
Go to empty page
<script>
    const Inp = {
        data: function () {
            return {
                v: '',
                test: []
            }
        },
        mounted() {
            for (let i = 2000000; i > 0; i--) {
                this.test.push(i)
            }
        },
        template: `<input v-model="v"></input>`
    },
        Empty = { template: '<div>empty</div>' },
        routes = [
            { path: '/input', component: Inp },
            { path: '/empty', component: Empty }
        ],
        router = new VueRouter({
            routes
        }),
        app = new Vue({
            el: '#app',
            router
        })
</script>

Steps to reproduce

1.Click Go to input page link,collect garbage and take a snapshot with devtools
2.Enter any value in the input box,collect garbage and take a snapshot with devtools
3.Click Go to empty page link,collect garbage and take a snapshot with devtools

What is expected?

Data memory release in component data

What is actually happening?

Not released,variables test are still in memory


If the input box does nothing and leaves the page, the component data can be freed normally

@posva
Copy link
Member

posva commented Aug 17, 2020

Duplicate of #10004

@posva posva marked this as a duplicate of #10004 Aug 17, 2020
@posva posva closed this as completed Aug 17, 2020
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