lua-users home
lua-l archive

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


On Fri, Dec 10, 2021 at 5:07 AM 云风 Cloud Wu wrote:
>> I don't think the things can lead to OOM error, even in finalizer.
>> The problem may ocur when we use 'collectgarbage' inside of finalizer.
>> Do concatenating, creating table, and adding a new key lead to any single 'step' in garbage collecting algorithm?
>>
>> --Regards, Jihoi.
>
>
> They allocate memory. Memory allocations can trigger the GC if there's not enough available.

They allocate memory and advance current GC progress, but they won't
change the mode of GC.

My reply was about Roberto's suggestion to "forbid any GC operation while running
a finalizer"
If GC inside a finalizer is disabled, then simple operation "t.x=1" might raise OOM.
And it would be very difficult to find such a mistake in a Lua program.
You can not cover it with tests.