- Joined
- Jun 18, 2004
- Messages
- 119
Hello guys,
With the advent of lua I thought things would become easier, as destruction of tables was no longer required. However, while playing with it I found that things a bit less so... I've been trying to make sense of the garbage collection system, but am really having trouble to do so.
If we create a table as such:
it takes a little over 15(!) seconds for it to be removed from memory (evident by its print when __gc is called). To make matters worse, it seems to depend on how 'busy' lua is. The more it is currently doing, the less it is concerned with freeing memory. This can lead to long exit-times in heavily triggered maps.
It seems to me that we have 0 control over memory management and therefore that repeated dynamic allocation of tables is a big nono.
Please correct me if I am missing something, or if there are other ways to ensure good memory management!
-inf
With the advent of lua I thought things would become easier, as destruction of tables was no longer required. However, while playing with it I found that things a bit less so... I've been trying to make sense of the garbage collection system, but am really having trouble to do so.
If we create a table as such:
Lua:
mt = {}
function mt.__gc(self)
print(self)
end
A = {}
setmetatable(A,mt)
It seems to me that we have 0 control over memory management and therefore that repeated dynamic allocation of tables is a big nono.
Please correct me if I am missing something, or if there are other ways to ensure good memory management!
-inf