Reputation: 58531
In titanium mobile, I am creating a game. After level one, I want to remove all the parts associated with level one, and create level two. How can I do this, whilst ensuring, that level one is removed from memory also.
I am doing it like this, but I don't know if the view is still taking up memory.
myView = Titanium.UI.createView()
view.remove(myView)
Upvotes: 0
Views: 130
Reputation: 154
Yes and no. It depends if your javascript context is still referenced in your application.
When doing the view.remove(myView) you are only removing the myView from the view "rendering stack"... it will be no longer displayed within the view... However, the object itself still exists in the javascript context where it was declared/initialized. You can check this by printing the myView before and after teh remove statement.
If you could also guarantee that, that same context is no longer referenced anywhere in your app, the garbage collector will discard and free that object's memory.
Upvotes: 1