Memory limitations - any solution?

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

Memory limitations - any solution?

David McNab
Hi,

Is there any way to get Plua to create a memory pool bigger than its
sub-256k?

Whenever a PalmDoc file exceeds about 50k, the statement:

  io.open("docfile", "r"):read("*a")

causes an 'out of memory' messagebox and program termination.








 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply | Threaded
Open this post in threaded view
|

Re: Memory limitations - any solution?

migueletto
No,

> Is there any way to get Plua to create a memory pool bigger than its
> sub-256k?

The memory pool size is not controlled by Plua. It is a PalmOS
limitation and its size varies between models and OS versions. A
device can have 8MB of total memory but only 256KB of dynamic memory,
which is what matters for memory allocation.

> Whenever a PalmDoc file exceeds about 50k, the statement:
>
>   io.open("docfile", "r"):read("*a")
>
> causes an 'out of memory' messagebox and program termination.

Reading the whole file at once is what causes the problem. Then you
reach another PalmOS limitation, which is the maximum size of
contiguos free dynamic memory. You may still have 100KB of total free
dynamic memory, but only as four 25KB blocks, so PalmOS can not
allocate a 50KB block. There is another limit: the maximum block size
is always 64KB, even if you have 100KB of free contiguos memory.

Instead of reading the whole file, you should read small parts each time.

Regards,
Marcio.





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply | Threaded
Open this post in threaded view
|

Re: Memory limitations - any solution?

David McNab
--- In [hidden email], "migueletto" <mmand@...> wrote:
> The memory pool size is not controlled by Plua. It is a PalmOS
> limitation and its size varies between models and OS versions. A
> device can have 8MB of total memory but only 256KB of dynamic memory,
> which is what matters for memory allocation.

> Instead of reading the whole file, you should read small parts each
time.

Many thanks for the clarification

Cheers
David






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/plua/

<*> To unsubscribe from this group, send an email to:
    [hidden email]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/