On Tue, 29 Oct 2024 at 07:49, user202729--- via luatex <luatex@tug.org> wrote:
> I notice that repeated calls to `token.set_macro` consumes up memory, even > though the macro themselves are freed. > > For example: run the following command > > ``` > lualatex '\directlua{for i=1,50000000 do token.set_macro("a", "") > end}\stop' </dev/null > ``` > > This will consume a few GB of memory before terminating. > > After looking at the source code, the reason is because the reference > count is not correctly zeroed, which leads to the token list not being > freed when the macro is overwritten. > > The following patch should fix the issue. > > Ok, I will check it.