lua-users home
lua-l archive

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


Mauro Iazzi wrote:
On my computer (x86_64) this runs well. Using -m32 to generate 32 bit
code recreates the freeze.

However it seems to me that this is not a bug. If you read the
definitions of the gc parameters, you will see that you are asking the
collector to start whenever the memory grows over 100% of what's
currently used.

If a collection cycle has just finished then it cannot reclaim any
memory, and whatever threshold it wants to get under (probably a
percentage of current), it cannot reach it. Thus it remains in the
loop you have seen. Try using collectgarbage("setpause", 101) : it
seems to fix things here.

I would agree that it's not a bug, then. Lua could throw an error, but that just adds an extra check to the garbage collection. I think it'd be sufficient and easier to put a notice about it in the manual ("asking the GC to collect when memory grows to 100% of its current size will cause an infinite loop" or some such). I don't think it would be enough of an issue to actually code a specific check for it, but that's certainly an option as well. I guess GC operations take long enough that a couple extra machine instructions wouldn't hurt.

Another interesting question is why the 64-bit Lua can do it just fine. Any thoughts?

--
Irayo