lua-users home
lua-l archive

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

Ralph Hempel wrote:
Bogdan Marinescu wrote:
As part of my "Lua for microcontrollers" project (, I'm trying to reduce the memory footprint needed by Lua. With all the eLua auxiliary modules enabled, "print(collectgarbage'count')" reports about 25k right after the Lua interpreter starts - quite a bit for a micro than can only access 64k of RAM. So I'm looking for ways to reduce this.

Would that be something in range of AVR32 or PIC32? They look mighty interesting for projects needing less than an ARM, but I've always wondered if a garbage-collecting runtime is suitable for such MCUs... Some of those USB/Ethernet-integrated versions are so attractive if we can Lua-script, but those lower-end ones like PIC18 would probably need some kind of fixed allocation scheme.

We'd have to come up with some way of defining the tables
at compile time, with the obvious disadvantage of not being
able to modify them later.

The original Basic Stamp had 26 global variables only -- that's one way. It's too bad most MCUs (in the AVR/PIC style) have so much program memory and so little internal RAM.

Has anyone run Lua with garbage collection with this kind of memory for a serious application, or does the embedded h/w developer carefully check to make sure that the app does not run out of memory?


Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia