If you are determining that the stack is not empty via the return value of lua_gc then you are mistaken. The stack is not the only place when memory is used and a separate stack space is given to each C function which Lua calls, for instance there is _G the global table or _ENV the environment table in 5.2 (of which there can be many) and also the registry. Added to this a variable which is on the stack and also stored in another place will not be collected.
Rest assured your stack is empty and after such a time that there are no more references to the data, without you doing a gc (never mind 10), the memory will be released.
Show differencesHistory of post edits
#2dmail
Posted 09 May 2012 - 05:55 AM
If you are determining that the stack is not empty via the return value of lua_gc then you are mistaken. The stack is not the only place when memory is used and a separate stack space is given to each C function which Lua calls, for instance there is _G the global table or _ENV the environment table in 5.2 (of which there can be many) and also the registry. Added to this a variable which is on the stack and also stored in another place will not be collected.
Rest assured your stack is empty and after such a time that there are no more reference to the data, without you doing a gc (never mind 10), the memory will be released.
Rest assured your stack is empty and after such a time that there are no more reference to the data, without you doing a gc (never mind 10), the memory will be released.
#1dmail
Posted 09 May 2012 - 05:53 AM
If you are determining that the stack is not empty via the return value of lua_gc then you are mistaken. The stack is not the only place when memory is used and a separate stack space is given to each C function which Lua calls, for instance there is _G the global table or _ENV the environment table in 5.2 (of which there can be many) and also the registry. Added to this a variable which is on the stack and also stored in another place will not be collected.
Rest assured your stack is empty and in time without you doing a gc (never mind 10) the memory will be released.
Rest assured your stack is empty and in time without you doing a gc (never mind 10) the memory will be released.