Mail Archives: djgpp/1996/07/11/13:01:28
> > In V2, how can I find at run time how much free stack space is left?
> You can get the address of the farthest (lowest) location of the stack (by
> calling `alloca (256K)' at the beginning of `main') and then look at the
I don't think this will work - and will probably overrun the stack with
bad consequences.
In general, finding out the base of the stack is a very difficult task
in V2, especially since a DPMI provider may chose to give it to you at
a non-contiguous point. In general, it's usually at (see <stubinfo.h>)
_stubinfo + sizeof(_GO32_StubInfo).
You can also check this plus the stklen variable, get the size, and
subtract from the current %esp via an asm() block. If this value is
far from the stubinfo value above, it's probably in a different memory
zone.
It probably ought to just be a variable, as someone sent a patch for.
I have an ugly routine someplace which determines the amount of
stack used so far (and also how much is left) - I probably ought to
just package them up.
- Raw text -