[comp.lang.pascal] Help! dos calls in tp

01mdschnapf@bsu-ucs.uucp (04/19/91)

I need help desperately.   I am writing a program for my semester project
and ran into a hurdle that I can't cross.  I am making a menu program
for my school's network system.  It is complete except for one thing.  I
can't figure out how to free up enough space to run programs.  I have
figured out that I won't be able to use Swapvectors and Exec.  I am trying
to use batch files and send the batch file to dos through dos calls.
I think I need to have the menu program terminate and then run the batch.
But I am open for suggestions!!!  I have no idea what to do.  Your help
will be much appreciated.  Thanks.
Michael Schnapf

kushmer@bnlux1.bnl.gov (christopher kushmerick) (04/20/91)

In article <1991Apr19.131120.715@bsu-ucs.uucp> 01mdschnapf@bsu-ucs.uucp writes:
>I need help desperately.   I am writing a program for my semester project
>and ran into a hurdle that I can't cross.  I am making a menu program
...



Make sure that in any programs that use exec, that they only allocate
as much heap/ stack space as they will need. If you do not specify,
then the pascal program will allocate all available memory as heap
space, and something like 64KByte of stack space even if you don't
do a single memory allocation (getmem, New()) and even if your
program only needs 2048 of stack.


Use the following


{$M 2048,0,0}

This gives you a 2048 stack, and allocates no heap for you program.

Of course if your program does use the heap, you'll need to do a rough
calculation of how much, and then adjust the second two parameters
accordingly.


See the docs for discussion of {$M}

Also make sure stack checking is on, so that if you do need substantial
stack space, you can adjust the first parameter accordingly (just keep
doubling it until you no longer get a run time stack crash error.)
-- 
Chris Kushmerick                                 kciremhsuK sirhC
kushmer@bnlux1.bnl.gov    <===Try this one first
kushmerick@pofvax.sunysb.edu 

-- 
Chris Kushmerick                                 kciremhsuK sirhC
kushmer@bnlux1.bnl.gov    <===Try this one first
kushmerick@pofvax.sunysb.edu