View Single Post
05/11/14, 11:40 PM   #2
CatoTheElder
Join Date: May 2014
Posts: 44
Hey Raven,

In modern versions of lua, garbage collection is automagically done. However, for optimal performance, you may want to run it manually. I hope this is what you're looking for.

-- variable declaration and memory allocation
tblBigTable = {}

-- populate the table
for i=1,100000 do
tblBigTable[i] = i*2
end

-- set the table as 'garbage'
tblBigTable = nil

-- automatic garbage collection will take care of it... eventually OR
-- manual garbage collection, to free up all that memory
collectgarbage("collect")
Lua Manual Reference:
http://www.lua.org/manual/5.1/manual...collectgarbage

Cheers!
  Reply With Quote