[comp.os.cpm] Determining TPA Requirements of Programs

SAGE@LL.ARPA (04/30/88)

Richard Secrist asked about determining the amount of TPA that a program
needs.  There is no way in principle to do this.  Well written programs
test to make sure they have enough room and abort with a suitable message
if they don't.  On the other hand, there probably are not very many well
written programs (I certainly have not written too many of them!).
 
An experimental approach would involve zeroing out the TPA memory (for
example, with DDT), then running the program, and finally examining
memory to see what data got written where.  Under Z System it is easy
to examine memory without using any (with the RCP peek command), but there
is undoubtedly some way to do this under CP/M as well.
 

budden@tetra.NOSC.MIL (Rex A. Buddenberg) (05/02/88)

Checking before you run a program to see if there is enough
TPA may not be enough by itself.  Consider a program that
allocates itself both stack and heap space.  Typically, the
stack space is static and resides right above the code itself.
Heap usually starts just below all the CPM stuff in high memory
and works down.  And heap is usually data driven -- you can't
know how much data there will be at program design time.
Early Pascal compilers for CPM were great fun to watch when
you could cause a heap/stack collision (i.e. run out of TPA) which
would send everything off into the weeds -- correctable only by
a cold boot.

Rex Buddenberg