Re: VM/GC question for gurus.

Roberto Ierusalimschy <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
> > 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")


> Will calling lua_gc(L, LUAGC_STEP, st.st_size /* This is the buffer size */
> )
> after successful loadbufferX be adequate as a contention measure? Or maybe
> just doing lua_createtable(L,0,0) ? ( I am not sure of a constant string, I
> think interning may skip string creation and checks ) Although it does only
> show up in tests/benchmarks in an artificially memory low VM  I would
> prefer to plug the hole.

'lua_pushstring' and its variations all check the GC, independently
of interning. (That is why luaL_loadfile has no issues.)

-- Roberto

-- 
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/20260318175557.GA72053%40arraial.inf.puc-rio.br.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.