lua-users home
lua-l archive

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


> From: lua-bounces@bazar2.conectiva.com.br 
> [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of 
> Richard Ranft
> 
> I don't know about the Lua internals, but for a memory 
> management system I'd look into something like the 
> frame-based memory system described by Steven Ranck in Game 
> Programming Gems vol.1 on page 92.  This system lends itself 
> fairly well to gc and dynamic allocation.

The frame based allocation approach doesn't maintain headers for the
individual memory allocations.  In this way, it is more efficient for
allocation and freeing of blocks of memory.  Unfortunately, the extra
performance (both speed and size) doesn't lend itself well to the dynamic
memory allocation Lua performs.  Lua's memory blocks come in all shapes and
sizes, and they are never freed in a consistent sequential order.  The frame
based approach would only work well if Lua allocated a whole bunch of memory
and then freed it in reverse order.  With the way Lua is architected and the
dynamic nature of the scripts it runs, I'm certain this couldn't work for
Lua 5.0.

Josh