Skip to content
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

__vfrag__ references prevent GC of Vue objects #2161

Closed
elsassph opened this issue Jan 14, 2016 · 0 comments

Comments

Projects
None yet
2 participants
@elsassph
Copy link

commented Jan 14, 2016

Unless the host DOM element is fully removed (from DOM and from references), __vfrag__ references seem to prevent full garbage collection of the Vue objects.

Using Chrome Profiler, after the vm object is destroyed we can still find references through __frag__ between the DOM and the Vue objects:

var data = {
    items:[
        { title:'Item 1', position:[0, 0] },
        { title:'Item 2', position:[200, 0] },
        { title:'Item 3', position:[0, 100] },
        { title:'Item 4', position:[200, 100] }
    ]
};

Vue.component('tile', {
    props: ["item"],
    template:`
        <div class="tile" :style="position">
            <b>{{item.title}}</b>
        </div>`,
    computed: {
        position: function() {
            var pos = this.item.position;
            return `left:${pos[0]}px; top:${pos[1]}px`;
        }
    }
});

var app = new Vue({
    el: '#app',
    template:`
        <div class="grid">
            <tile v-for="item in items" :item="item"/>
        </div>`,
    data: data
});

setTimeout(function() {
    app.$destroy();
    app = null;
    console.info('destroyed');
}, 2000);

@elsassph elsassph changed the title __vfrag__ references prevent GV of Vue objects __vfrag__ references prevent GC of Vue objects Jan 14, 2016

@yyx990803 yyx990803 closed this Jan 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.