[comp.os.os2.misc] How to figure out the amount of stack space?

wbonner@eecs.wsu.edu (Wim Bonner) (03/09/91)

Does anyone have a utility program available that can tell me approximately how 
much stack space I should have available for a program, given a set of source 
code files?  I think part of my problem right now is stack space, but I don't 
know, and I can't really enable stack checking in a pm program.  (I don't think 
I can at least)

Wim.
-- 
|  wbonner@yoda.eecs.wsu.edu  |
| 27313853@wsuvm1.csc.wsu.edu |
|  72561.3135@CompuServe.com  |

n8840371@unicorn.cc.wwu.edu (Todd Crowe) (03/09/91)

(I was going to reply directly but other people might be interested as well.)

In comp.os.os2.programmer wbonner@yoda.eecs.wwu.edu writes:
>Does anyone have a utility program available that can tell me approx. how 
>much stack space I should have available for a program, given a set of source 
>code files?  I think part of my problem right now is stack space, but I don't 
>know, and I can't really enable stack checking in a pm program. (I don't think 
>I can at least)

Think about it.  Your stack grows dynamically according
to what happens in the program.  The only way you can see how much stack
you need is to monitor the size of the stack while the program is running.
This won't/can't really even answer the question, though, because you still
don't neccessarily know what you will need in the worst case.

Yes, you can enable stack checking in a PM program.  The reason
that it is not recommended is that you the __chkstk routine outputs to stderr
(I could be wrong, it might be stdout - but that wouldn't make much sense).
In any case you can simply redirect output of the PM program to a file and
any messages will show up there.  This is a good way to debug PM programs
in some cases and is easier than sending error codes specifically to a file.

           |                   Todd Crowe                        |
           |  n8840371@unicorn.wwu.edu or TODDC@nessie.wwu.edu   |
   There are three types of people, those who can count and those who can't.

wbonner@eecs.wsu.edu (Wim Bonner) (03/10/91)

In article <1991Mar9.013432.11522@unicorn.cc.wwu.edu> n8840371@unicorn.cc.wwu.edu (Todd Crowe) writes:
>Yes, you can enable stack checking in a PM program.  The reason
>that it is not recommended is that you the __chkstk routine outputs to stderr
>(I could be wrong, it might be stdout - but that wouldn't make much sense).
>In any case you can simply redirect output of the PM program to a file and
>any messages will show up there.  This is a good way to debug PM programs
>in some cases and is easier than sending error codes specifically to a file.

Ok, so how do I re-direct STDERR in OS?2?   I know to use >& in unix, but how 
do I handle it in OS/2?

-- 
|  wbonner@yoda.eecs.wsu.edu  |
| 27313853@wsuvm1.csc.wsu.edu |
|  72561.3135@CompuServe.com  |

n8840371@unicorn.cc.wwu.edu (Todd Crowe) (03/10/91)

wbonner@eecs.wsu.edu (Wim Bonner) writes:
>Ok, so how do I re-direct STDERR in OS?2?   I know to use >& in unix, but how 
>do I handle it in OS/2?

How about >2 (2 is the fd for stderr, > defaults to 1 (stdout), < to 0)?

           |                   Todd Crowe                        |
           |  n8840371@unicorn.wwu.edu or TODDC@nessie.wwu.edu   |
   There are three types of people, those who can count and those who can't.