lua-users home
lua-l archive

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


from "Nick Trout" <nick@videosystem.co.uk>
>  Does Lua do garbage collection at arbitrary intervals (eg. when it
>  decides gc is appropriate) or must lua_garbagecollect(sp?) be called
>  explicitly? I need Lua for realtime.

Usually Lua do gc at "arbitrary intervals" (when the total memory in use is 
twice the memory in use just after the last gc), but you can change that. 
When you call collectgarbage, you supply the number of "blocks" that Lua 
will create before doing gc again (0 keeps the default). If you give a 
large number (LONG_MAX, say), you will prevent any implicit activation of 
gc. 

-- Roberto