[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua running on PalmOS!
- From: "Russell Y. Webb" <rw20@...>
- Date: Sun, 04 Mar 2001 23:32:38 -0800
> 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!
FtrPtrNew allocates arbitrary sized memory chunks from the storage heap.
There's also a lower level allocation from the Storage heap that has nothing
to do with features and can allocate >64k (can't recall it's name, something
like MemNewChunk). So you could allocate say 4Megs and then sub-allocate
from that.
Of course you still have to use DmWrite to write to the memory. Seems like
the Lua source would have to be extensively modified to fix that (perhaps
though some macros so you could revert back to normal pointer writing on
another platform). Reading memory is fine of course. Lot's of small writes
are likely to have a serious speed hit so some sort of memory swapping
architecture might be in order. You could try MemSemaphoreReserve and
MemSemaphoreRelease before and after each ptr write but then you're starting
to play with fire since unbalancing those is BAD and holding that semaphore
allows you to trash the storage heap (where the user data is).
Ah, the joys of strange memory models.
Also note that you have a VERY limited C stack in PalmOS. Say about 2-4k.
In recent versions you can bump that up but only by consuming dynamic heap
so you are still effectively limited to about 16k (at most).
Russ