lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Wed, 17 Apr 2002 11:42:59 -0700, Eric Ries wrote:
>I have a lua memory usage question. I am running a lua (4.0)
>interpreter in
>a limited-memory situation. I am having it parse about 600K of lua
>Now, what I?ve noticed is that, most times, this succeeds. The
>memory usage levels out at around 50k after all files are parsed and
>executed. However, during the initialization/parsing time, the
>memory usage
>sometimes spikes - occaisionally (but not always) overflowing my
>700K limit.
>Now, I am curious if anyone has suggestions about how to
>this situation. How much memory does Lua need to build its parse
>tree? If I
>pre-compiled the scripts into bytecode, would that improve the

I'm working with lua3.2 in a very limited memory embeded system and 
encoutered this situation some times ago. With very big lua file with 
some construction the parser generate a very big tree. Personnaly I've 
solved the problems by precompiling all the file and only parse a small 
file with config information downloaded by network.

If you have a lot of static code, the best was to precompil it.

For your problem on executing this precompiled chunk, are you sure your 
lua files wasn't modified between compilation and execution ?

Thomas Lavergne                       "Le vrai rêveur est celui qui rêve
                                       de l'impossible."  (Elsa Triolet)                                        ICQ:#137121910