lua-users home
lua-l archive

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



On Mon, Sep 12, 2016 at 8:58 AM, Marc Balmer <marc@msys.ch> wrote:
Does collectgarbage('count') report only the memory the Lua core allocated or would it contain memory that a C function allocated using malloc()?


Marc,

It only reports memory that has been allocated via the Lua core, so if you call malloc() to allocate content within your code and then bind it as light user data it will not be allocated.  However if you bind it using the Lua newuserdata() API then it will be accounted for because the allocation is 'coming through Lua'.

Thomas