Page 1 of 1
Release resource
Posted: Sat Nov 20, 2010 10:17 am
by Blady
Hi
I have simple question. How to release a resource?
My idea is:
Code: Select all
image = love.graphics.newImage("some_nice_image.jpg")
...
image = nil
It's good? I think, it doesn't release a memory.
Re: Release resource
Posted: Sat Nov 20, 2010 10:53 am
by Robin
Pretty much. As soon as there is no reference left to an object, it is availably for the garbage collector to release it. You don't have to worry about this most of the time, though.
Re: Release resource
Posted: Sat Nov 20, 2010 11:25 am
by Blady
But when My program have a structure like that:
Code: Select all
Game have a modules:
1.Menu
2.Game
When Menu has left for a Game module, Menu resources need to be free.
Something like that. shouldn't I take care about Menu resources? and for others any modules that I will have?
Re: Release resource
Posted: Sat Nov 20, 2010 11:36 am
by Robin
I doubt it.