Re: VM/GC question for gurus.
Francisco Olarte <[email protected]>
| Newsgroups | gmane.comp.lang.lua.general |
|---|---|
| Message-ID | <CA+bJJbwA9XrcmED7Dq+2NgzLgPYCyQwfmNf8_o7SBmsgMP2Mgg@mail.gmail.com> |
On Wed, 18 Mar 2026 at 18:56, Roberto Ierusalimschy <[email protected]> wrote: > > > You may be right; we will check that. luaL_loadfilex creates a new > > > string with the file name (calling 'lua_pushfstring'), and that call > > > checks the collector. But lua_load does not do that check. > > If the chunk is text, the parser checks the collector, but with a binary > chunk really there is no check. The following program shows the problem: > > local s = "return 34" > s = string.dump(load(s)) > for i = 1, 1e8 do load(s) end > io.write(collectgarbage"count" * 1024, "\n") > You beat me to it. I read lua_load, notice the undump() call and redid my tests using the uncompiled chunk, it was 10 times slower but did not exhibit the OOM problem. > 'lua_pushstring' and its variations all check the GC, independently > of interning. (That is why luaL_loadfile has no issues.) > OK, will add a commented pushstring then. Thanks. Francisco Olarte. -- 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 [email protected]. To view this discussion visit https://groups.google.com/d/msgid/lua-l/CA%2BbJJbwA9XrcmED7Dq%2B2NgzLgPYCyQwfmNf8_o7SBmsgMP2Mgg%40mail.gmail.com.