Relasing Loaded Data

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
robbythedude
Prole
Posts: 5
Joined: Mon Feb 20, 2012 7:13 pm

Relasing Loaded Data

Post 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!
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Relasing Loaded Data

Post by thelinx »

You just rely on Lua's garbage collection.

Code: Select all

image = nil
The memory will be freed when needed.
robbythedude
Prole
Posts: 5
Joined: Mon Feb 20, 2012 7:13 pm

Re: Relasing Loaded Data

Post by robbythedude »

Easy Enough, Thank You Very Much!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests