lua-users home
lua-l archive

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


> On my host system, Ubuntu VM with 1G of RAM it runs <forever> without
> increasing memory use. On the embedded target I get the same out of
> memory message eventually, which surprised me. Also top reports that
> the Lua process is holding around 40M of memory.
> 
> If I traverse 'bigtab' it is empty, as expected and 'print(gcinfo())' reports 20-30k of memory in use. Then if I do 'bigtab={}; collectgarbage(); print(gcinfo())' the Lua shell reports that it is only using a minimal amount of memory again but there is around 40Mb of RAM still held by the Lua shell reported by top. Once I exit the shell this is released, but it looks as though the allocator (or GC) has leaked a pile of memory.

You may try to change your program to call gcinfo() through the entire
loop and check what is its maximum value, so you will know whether Lua
is actually using lots of memory and releasing it or the problem is
with the memory allocator in your system. (Unless some unknown bug, the
result from gcinfo() is the number of bytes allocated and not yet freed
by Lua, including everything.)

-- Roberto