lua-users home
lua-l archive

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


On Sun, Mar 04, 2001 at 09:22:21AM -0800, Jean-Claude Wippler wrote:
> >* rewrote Lua's generic memory allocator
> 
> What are the limits of such an approach?  Once an application is built
> this way, does it have the ability to deal with reasonable amounts of
> data, well over 64 Kb, that is?

The implementation still suffers from the memory limits of the PalmOS. Memory allocated via MemPtrNew or MemHandleNew is limited to 64K, so are database records. Any blocks of data that Lua allocates cannot be larger than that, or ca-boom!

The dynamic heap(where memory is allocated from) is roughly 96K, at runtime its usually less. So Lua and your app share that remaining amount of memory. 

I basically replaced Lua's memory allocator to allocate and free memory with MemHandleNew/Free and MemHandleLock/Unlock. I used memory handles because during a reallocation of memory, if there is no free space at the end of the chunk the PalmOS will relocate the entire chunk if possible, unlike a regular pointer where the reallocation would fail.

> Not sure where I will go with this, a stable port maybe? Comments?n
> Yes, please.  As Palm owner, I'd be very interested to try this and build
> on top of it.   One month from now there will be an announcement which
> could make this port quite, ehm, interesting...

And what annoucement would that be?

-Lenny