Question about memory management

Say I have

foo = display.newImage("foo.png",10,10) foo.bar = display.newImage("bar", 10,10) foo:removeSelf() foo = nil

So, if I nil out the “foo” variable, will “bar” still exist in memory? or it gets nil’ed out aswell? Thanks!

The reference foo.bar will be nil, but the display object is still there and takes memory. And the problem is, that you got no other reference to this object, so you cant delete it and free it’s memory.

The reference foo.bar will be nil, but the display object is still there and takes memory. And the problem is, that you got no other reference to this object, so you cant delete it and free it’s memory.