Page 1 of 1

Limit on size of System.Alloc

Posted: 25 January 2008, 6:27 AM
by mikep
In my "manytask2.bas" stress test I tried to allocate a single heap area for all of the task stacks but System.Alloc returned a zero.

After some further work I then tried allocating an area of memory for counters where each counter used 2 bytes (instead of the original 1). I found that the maximum number of integer counters I could allocate was 1791. If you include two bytes for the allocation size, the maximum is 3584 bytes (or 3.5K exactly).

This maximum of 3582 bytes appears to be undocumented.

Naturally I would like to see this limit increased (to 64768 if possible). Then the maximum tasks can be raised from 2021 to 2156 ;)

Re: Limit on size of System.Alloc

Posted: 25 January 2008, 8:03 AM
by dkinzer
mikep wrote:This maximum of 3582 bytes appears to be undocumented.
The limit on the size of a single allocation request is currently hard-coded to be the size of internal RAM less the size of the portion set aside for system use. While this is suitable for devices without external RAM, it does impose an unnecessary restriction in cases where there is external RAM.

We are experimenting with some ideas to solve this problem and, at the same time, more reliably detect a collision between the Main() task stack and the heap.