lua-users home
lua-l archive

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

Shmuel Zeigerman wrote:
Bradley Smith wrote:
Can someone explain to me why setting collectgarbage("setpause", 300) on either Linux or Windows will cause the previously posted program to never collect garbage?

If I understand it correctly, with pause>=200, the rate of garbage collection can be less than that of garbage accumulation.

Quote from the Lua 5.1 Reference Manual:

The garbage-collector pause controls how long the collector waits before starting a new cycle. Larger values make the collector less aggressive. Values smaller than 1 mean the collector will not wait to start a new cycle. A value of 2 means that the collector waits for the total memory in use to double before starting a new cycle.

End quote.

What is considered a garbage collection cycle? Why does memory usage grow to more than triple if the pause is set to 3 ("setpause" of 300)?

It seems like a cycle is not the same as calling collectgarbage() because if I insert a collectgarbage call into the loop of the example program, the unbounded accumulation of memory does not occur.