[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Execution of bytecodes
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Fri, 2 Oct 2015 13:41:46 +0100
2015-10-02 11:01 GMT+01:00 Marc Balmer <firstname.lastname@example.org>:
> When I pass precompiled Lua bytecode to Lua using lua_loadXXX functions by passing a pointer to the bytecode in memory (e.g. after mmaping the file containing the byte code into memory), will that directly be used or will there new memory be allocated and the bytecode be copied?
I believe Peter Cawley already gave the most relevant answer (short of
looking at the source or an author answering directly), so I won't
expand on that.
A similar feature that has been asked before is to do that for
strings, for example to use read-only memory on low-RAM platforms. I
believe eLua has such a feature, and IIRC Roberto mentioned it (in a
recent workshop video) as a potential future feature for Lua. If that
ever makes it into Lua for strings, it would be nice to have the same
option for bytecode. But on the other hand, contrary to strings, the
runtime memory layout of the function prototypes may not be exactly
that of the serialized bytecode.