lua-users home
lua-l archive

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


I have the same problem.  I have to be agressive about forcing the garbage collector during loops.  When newbe's run lua for the first time on embedded systems, they have the same problem, even on heaps in the mega bytes.  ( They run over night tests.)  Lua gets a black eye because they think is memory leaks inside the engine, and I have to do a song and dance to smooth out the situation.

I thought about changing it, but in my line of work it is important not to touch the baseline and only extend and embedded.

Glenn Edgar

On 3/22/07, Ralph Hempel <rhempel@hempeldesigngroup.com> wrote:
I've got a bit of a problem that I hope some gurus can
help me out with.

I'm running 5.1.1 on a very memory constrained system. It's
the LEGO NXT and I have about 52K of RAM allocated to
the heap, which is controlled by malloc()

Once I've loaded the API for the NXT peripherals (C binding to Lua)
the gcinfo() tells me I have about 16K left - which I find hard
to believe. There are about 40 calls to C functions.

What can I tune in the source to force the gc to be more
aggressive, and can it work if I give it a fixed block of
memory that can never be expanded?

Also, can I force the gc to run during script evaluation?

Sometimes if a script is large or complex, the malloc()
I have simply bails and dies saying it can't allocate
any more memory.

Cheers, Ralph