Destruction of models / collections / components and GC

@theryanjduffy I'm just wondering how GC is done and what happens in Enyo when a model / collection /component is destroyed?

I know the ".destroyed" flag gets set to true but do I need to explicitly check for this in subsequent enyo.store.finds? Or will it not return these objects because they are destroyed? And how long until they are GC (I assume it's browser dependent) and no longer show up in console?

Thanks!

Comments

  • Had to refresh myself on that code base a bit but I believe that once you destroy() a Model (either explicitly or by passing the destroy option to Collection.remove()), it will be removed from the store and any collections. You shouldn't have to check for the status of a model as it is immediately removed from the store after the destroyed flag is added.

    If your app hasn't maintained any references to the Model, it will then be GC'd whenever the browser chooses to.
Sign In or Register to comment.