memory fragmentation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

memory fragmentation

Adam Wozniak
I just spent several hours reviewing the list archive, and I
know this has been asked here in various forms, but I couldn't
find a direct answer, so here goes...

I'm evaluating LUA for use as a script language in an embedded processor
environment.  The unit most remain in operation for very long periods of
time.  We have only 64K of RAM to work with.

We are very concerned about memory fragmentation.

The "standard" way of dealing with this is to use a double pointer or
"handle" method where the underlying operating environment can reshuffle
objects in memory pretty much at will.  An example frequently cited in
the list archive was PalmOS.

What sorts of mechanisms does Lua have to support this?

--Adam

Reply | Threaded
Open this post in threaded view
|

Re: memory fragmentation

Erik Hougaard
Adam Wozniak wrote:
> 
> I just spent several hours reviewing the list archive, and I
> know this has been asked here in various forms, but I couldn't
> find a direct answer, so here goes...
> 
> I'm evaluating LUA for use as a script language in an embedded processor
> environment.  The unit most remain in operation for very long periods of
> time.  We have only 64K of RAM to work with.
> 
> We are very concerned about memory fragmentation.
> 
> The "standard" way of dealing with this is to use a double pointer or
> "handle" method where the underlying operating environment can reshuffle
> objects in memory pretty much at will.  An example frequently cited in
> the list archive was PalmOS.
> 
> What sorts of mechanisms does Lua have to support this?
> 
> --Adam

We are working on the same, these are my observations:

1. Lua works of the ANSI malloc ralloc functions - the quality of these
functions are a good indicator of the lua speed/quality.

2. Lua uses some standard IO for error (That has been changed in 3.2) -
you must change this to your way of handling errors..

3. Lua uses ZIO (a file IO library) - all these functions must be
rewritten to support flash/eprom etc...

But it can be done :-)

Erik