Just a quick question about performance,
when i load an image or a sound or whatever when I'm done with it to avoid filling up the ram, do i have to get rid of it somehow?
thanks
Remove From Memory
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Remove From Memory
If your variable is called foo...
Code: Select all
foo = nil
Kurosuke needs beta testers
Re: Remove From Memory
http://lua-users.org/wiki/GarbageCollection
Here's some talk about the Garbage Collection that Lua uses. You don't need to explicitly delete stuff, Lua does it when it realizes you are no longer using it. One of those ways is by making it nil.
Here's some talk about the Garbage Collection that Lua uses. You don't need to explicitly delete stuff, Lua does it when it realizes you are no longer using it. One of those ways is by making it nil.
- slime
- Solid Snayke
- Posts: 3144
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: Remove From Memory
If you want to force a full garbage collection cycle for whatever reason, you can do so with collectgarbage("collect")
So you might have like
or something... It's not necessary 99% of the time though.
So you might have like
Code: Select all
wholebunchofimagesinatable = nil
collectgarbage("collect")
loadnewimages()
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: Remove From Memory
To make sure you don't use collectgarbage('collect') unnecessarily: if you have to ask, you shouldn't use it.
Help us help you: attach a .love.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest