Page 1 of 1

Relasing Loaded Data

Posted: Wed Feb 22, 2012 2:02 am
by robbythedude
The title might be a little misleading, so I will try to elaborate as best as possible.

I have a function that runs at the beginning of the game to load images that are only needed at that time. (Example is a Background Image of the Menu) I was just wondering if there is a way to free up/release that image so there is no memory being wasted?

Like,

Code: Select all

image = love.graphics.newImage(bLaaahhhh)
then to unload it,

Code: Select all

love.graphics.release(image)
^^Something like that. The almighty plan is to just limit the resources waiting on the back-burned to be called.

Hopefully I'm pretty clear, Thanks!

Re: Relasing Loaded Data

Posted: Wed Feb 22, 2012 2:27 am
by thelinx
You just rely on Lua's garbage collection.

Code: Select all

image = nil
The memory will be freed when needed.

Re: Relasing Loaded Data

Posted: Wed Feb 22, 2012 3:00 am
by robbythedude
Easy Enough, Thank You Very Much!