lua-users home
lua-l archive

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


> Is there a way to find out how much memory lua is using while its executing 
> script file?

See `gcinfo' (in Lua) or `lua_getgccount' (in C). (I am afraid gcinfo didn't
go into the manual...

  gcinfo ()
  Returns the number of Kbytes of dynamic memory Lua is using, and (as a 
  second result) the current garbage collector threshold (also in Kbytes). 

In Lua 4.0, that value is not exact: "[The] internal byte counter kept 
by Lua is not completely acurate; it is just a lower bound, usually within 
10% of the correct value."  In 4.1 it will be exact.

-- Roberto