lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, 5 May 2009 16:52:25 +0200
Gergely BOROMISSZA <Gergely.BOROMISSZA@navngo.com> wrote:

> I have some questions about Lua GC.
> As I can see Lua doesn't free up memory by garbage collecting, just
> marks it. 

Lua uses a system called mark and sweep.  It will free memory without
you touching anything at all.

> Should I really call collectgarbage with parameter
> "collect" to do this manually or with parameter "step" continuously?
> Is there any possibility to do this automatically perhaps
> parameterized with a memory limit?

The manual is an excellent place to start;

http://www.lua.org/manual/5.1/manual.html#pdf-collectgarbage (from Lua)
http://www.lua.org/manual/5.1/manual.html#lua_gc (from C)

B.