Add 'if _heavy then' check in 'testes/locals.lua' to prevent OOM

112 views
Skip to first unread message

Jure Bagić

unread,
Nov 13, 2025, 7:46:32 PMNov 13
to lua-l
Would be nice to add 'if _heavy then...' in 'locals.lua' when testing for
tbc variables high in the stack, this easily requires 32GB+ virtual memory
when stack size is INT_MAX/2 (for 32 bit int's).
Here 'testes/locals.lua:632', the assert at line 661 fails as 'obj' becomes
a string "out of memory", so 'obj[1]' is nil.
(latest commit 4cf498210e6a60637a7abb06d32460ec21efdbdc).

-- Jure
signature.asc

Roberto Ierusalimschy

unread,
Nov 27, 2025, 10:57:05 AMNov 27
to lu...@googlegroups.com
> Would be nice to add 'if _heavy then...' in 'locals.lua' when testing for
> tbc variables high in the stack, this easily requires 32GB+ virtual memory
> when stack size is INT_MAX/2 (for 32 bit int's).

I am not following you here. For 32 bit int's the stack size is not
INT_MAX/2, it is 1000000.

-- Roberto

Jure Bagić

unread,
Nov 27, 2025, 10:43:03 PMNov 27
to lu...@googlegroups.com
> --
> You received this message because you are subscribed to the Google Groups "lua-l" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/lua-l/20251127155700.GB36760%40arraial.inf.puc-rio.br.

I seem to have removed the conditional define here for testing purposes and
forgot to put it back, so that resulted in always having 'INT_MAX/2u' as
stack size, my apologies. Also small correction on my part, adding
'if not _soft then...', and not the 'if _heavy then...', but not that it
matters anymore.

-- Jure
signature.asc
Reply all
Reply to author
Forward
0 new messages