Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Finding out why a class isn't collected — Gideros Forum

Finding out why a class isn't collected

moopfmoopf Guru
edited April 2013 in General questions
Been going round in circles here for a few hours now. I have a main game object which simply refuses to be collected when I go back to the front end of the app. All of the sub-objects are using newproxy so I can tell if they are being collected, e.g.:
<pre>
self.proxy = newproxy(true)
    getmetatable(self.proxy).__gc = function() print("GameSpace has been collected") end
And every single one of them is being collected. I'm also forcing the removal of any remaining children from the game class just on the off chance but I still cannot get it to be collected as garbage at all. I'm stopping all timers, removing all events - basically doing everything I feel I should.

Does anybody have any other tips for tracking why an object is refusing to put itself up for collection? Going a bit mad here now. Normally I can get to the bottom of it quite quickly but not this time, I'm stumped.

Comments

  • Right I've worked it out but I'm not quite sure what's going on. I suspect it's something in my code, nothing wrong with Gideros but basically it's taking a long while for the game class to be collected - if I start the game class again before this has happened, the app crashes. If I force garbage collection, the previous object is correctly collected and no crash. What's causing the crash is an event being dispatched to the previous class even though it should have been collected. Obviously I'm doing something wrong somewhere but at least I know it is being collected, just not when I thought it would be.
Sign In or Register to comment.