lua-users home
lua-l archive

out-of-memory error: coroutines not collected?

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


 > [snip]
 > > for key, count in pairs(class) do
 > > f:write(string.format(' [%q] = %d,\n', key, count))
 > > end
 > 
 > You might not actually be leaking as much as continuously producing 
 > new garbage in this particular loop by using string.format. What may 
 > be happening is that the default garbage collector settings are 
 > delaying the start of a major collection cycle until your process 
 > image has doubled in size...
 > 
 > You can try ... collectgarbage("setpause", 120)
Nice idea; I'll try it.
Another experiment suggests that maybe Lua is not collecting dead
coroutines that are created by coroutine.wrap() and are used in a
generic 'for' loop. *Something* is getting delayed because on 
exit from the interpreter with EOF, my CPU pegs at 100% usage for
about 10 seconds. I assume those are GC finalizers doing something...
Norman

AltStyle によって変換されたページ (->オリジナル) /