General discussion about LÖVE, Lua, game development, puns, and unicorns.
Blady
Prole
Posts: 4 Joined: Sat Nov 20, 2010 10:08 am
Post
by Blady » Sat Nov 20, 2010 10:17 am
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.
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Sat Nov 20, 2010 10:53 am
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.
Blady
Prole
Posts: 4 Joined: Sat Nov 20, 2010 10:08 am
Post
by Blady » Sat Nov 20, 2010 11:25 am
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?
Robin
The Omniscient
Posts: 6506 Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:
Post
by Robin » Sat Nov 20, 2010 11:36 am
I doubt it.
Users browsing this forum: Ahrefs [Bot] , Bing [Bot] and 3 guests