[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: HELP - leak in lua 5.0.3
- From: Mikołaj Dawidowski <dawm@...>
- Date: Wed, 12 Jul 2006 17:51:13 +0200
I use lua 5.0.3 in my app.
The app works for days and it leakes memory.
The amount of the memory returned by gcinfo() grows about 10 MB / 24 h.
Calling collectgarbage() (even multiple times) doesn't help. Gcinfo()
indicates it continues to grow.
I thought that some global tables grow therefore I counted entries in _G
with the code is on the end of this email.
The number of globals is constant and yet the lua GC grows ( gcinfo() ) .
So I dig into lua source and found out that the collected elements are in
L->l_G->rootgc and ->rootudata
I think I can iterate over them by next_elem = cur_elem->gch.next . Is that
But how can I get type of the element?
-----------COUNTING GLOBALS -----------------
function count_table( t )
for a,b in pairs(t) do
if(tolua.type(b)=="table" and not(a=="_G") and not(a=="__index") ) then
print("--------------", os.date()," ----------")
print("NUMBER of globals:", count_g)
print ("MEM: ",a," KB")