Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Is calling destroy() on an Object necessary?

$
0
0

@jalapano wrote:

I'm wondering if calling destroy() on an Ember.Object that was explicitly created (i.e. not automatically created by the Ember framework) is necessary.

The documentation says that destroy() cleans any meta and bindings on the object. If you set null out the property that stored the Object, would that be sufficient or will data still be leaked and the object not be garbage collected?

Ember.Component.extend({
    testObject: null,  
    
    init() {
        this._super(...arguments);
        this.set('testObject', Ember.Object.create());
    },

    willDestroy() {
        this._super(...arguments);
        this.set('testObject', null); // Will this allow testObject to be garbage collected?
    }
});

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles