lua-users home
lua-l archive

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

On Wed, Nov 28, 2018 at 9:03 AM Philippe Verdy <> wrote:
> There's a fundamental difference even if the effect looks the same: the loop is not supposed to leak memory, but nothing is garbage collected. and most CPU time will be used by the garbage collector trying to finalize more and more objects without success, not in the Lua program itself but within the Lua virtual machine itself becoming completely out of control and probably crashing even before it can use the panic function.

Au contraire. Although your bottom-quoting style hides the code in
question, it can be read as "lets mt be a metatable which forbids
garbage collection, enter an infinite loop setting the metatable of a
local table to said gc-forbiding table". It's clearly supposed to leak
memory, tha same as the table.insert example by tim ( although the
second one does not leak, it consumes memory but it is clearly
reachable and not leaked.

> This is something needed for Lua programs that run threads to implement a web service,

NO, it is not. Lots of people run thread oriented web services without this.

Francisco Olarte.