lua-users home
lua-l archive

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

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 source.
Now, what I?ve noticed is that, most times, this succeeds. The steady-state
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 profile/optimize
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 situation?

Your comments are greatly appreciated,


PS. To attempt to answer my own question above, I tried compiling some of my
scripts into bytecode. When I run them in my interpreter, I get a seg
violation at lvm.c line 366:

    const Instruction i = *pc++;

Has anyone else encountered this problem?