[luatex] Memory leak in token.set_macro() implementation

luigi scarso luigi.scarso at gmail.com
Tue Oct 29 10:08:52 CET 2024


On Tue, 29 Oct 2024 at 07:49, user202729--- via luatex <luatex at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/luatex/attachments/20241029/ba0db13b/attachment.htm>


More information about the luatex mailing list.