lua-users home
lua-l archive

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


Hi Norman,

On Wed, 1 Apr 2009, Norman Ramsey wrote:

[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.

> Does anyone have any other suggestions?  See a memory leak?

You can try tuning the garbage collector using collectgarbage().  In 
particular you could try setting the collector pause setting to 
something much closer to 100 % with collectgarbage("setpause", 120).  
This will cause the GC to wait only a little while between major 
cycles.

Joonas