Task stack requirement calculated by Ramalyze

Started by Bob Dengler September 22, 2004
Is the stack requirement for tasks reported by Ramalyze the total number of
elements needed in the stack byte array, or should I be adding 15 for the
task frame? I've tried using the reported requirement from Ramalyze as the
size of the task array & seem to be having problems with it. The task
itself is very simple with only 1 local byte variable, two calls to Delay()
& two calls to PutPin() inside a For-Next loop.

Bob



--- In , Bob Dengler <no6b@r...> wrote:
> Is the stack requirement for tasks reported by Ramalyze the
> total number of elements needed in the stack byte array, or
> should I be adding 15 for the task frame? I've tried using the
> reported requirement from Ramalyze as the size of the task array
> & seem to be having problems with it.

The computed value does include the 15 bytes of overhead. However,
there are other factors that are not included: stack space used by
calls to System Library functions, stack space used by expression
evaluation, any other stack space requirements imposed by the BX-24
virtual machine that is not documented.

Because of the unknown factors, you should always allocate more stack
space than indicated. If you are sure that your test cases exercise
all possible paths and encounter all possible conditions, you can
start with a larger value and trim it down until the program begins
to fail when run through its complete test sequence and then bump it
up again.

The greatest value of the Ramalyzer output for me is to point out
where I can "flatten out" the call tree. Whatever your stack
requirements, you can generally reduce it by reducing the call depth.