Stack overflow help sought 
Author Message
 Stack overflow help sought

A friend gave me an old copy of Turbo C++ 3.0 for DOS. I'm using it to
write a program that plays Checkers. This requires a tree search using a
recursive MiniMax algorithm.

If I set the maximum number of plies of the tree to a fairly small
number, it ran fine. However, I tried iterative deepening of the code to
get it to find forced wins in the endgame better -- and started getting
an exception error (I'm running this is a DOS window under WIN 95). I
suspected stack overflow. Sure enough, when I turned on overflow
checking in the compiler, I get a stack overflow at somewhere between
2-4 plies nearly every time. It will normally run okay even at higher
plies if I turn stack checking off, but this clearly isn't something I
can just ignore.

I was given the compiler/de{*filter*}/IDE, but I don't have the
documentation for it. Here is the map file that the linker puts out. It
looks like I'm getting only 128 bytes for the stack, so the problem is
certainly no major surprise. I'd appreciate it if anyone with experience
with this package could give me some advice on how to a)increase the
size of the stack and b)reduce stack usage. Please address your reply to

Thanks,
Bruce

 Start  Stop   Length Name               Class

 00000H 0385EH 0385FH _TEXT              CODE
 0385FH 04F91H 01733H CHECKERS_TEXT      CODE
 04FA0H 04FA0H 00000H _FARDATA           FAR_DATA
 04FA0H 04FA0H 00000H _FARBSS            FAR_BSS
 04FA0H 04FA0H 00000H _OVERLAY_          OVRINFO
 04FA0H 04FA0H 00000H _1STUB_            STUBSEG
 04FA0H 05BD5H 00C36H _DATA              DATA
 05BD6H 05BD7H 00002H _CVTSEG            DATA
 05BD8H 05BDDH 00006H _SCNSEG            DATA
 05BDEH 05BDEH 00000H _CONST             CONST
 05BDEH 05BFBH 0001EH _INIT_             INITDATA
 05BFCH 05BFCH 00000H _INITEND_          INITDATA
 05BFCH 05BFCH 00000H _EXIT_             EXITDATA
 05BFCH 05BFCH 00000H _EXITEND_          EXITDATA
 05BFCH 05C8FH 00094H _BSS               BSS
 05C90H 05C90H 00000H _BSSEND            BSSEND
 05C90H 05D0FH 00080H _STACK             STACK



Wed, 14 Mar 2001 03:00:00 GMT  
 Stack overflow help sought
On Sat, 26 Sep 1998 13:23:05 -0400, "Bruce Bowman (remove NOSPAM to reply)"

Quote:

> A friend gave me an old copy of Turbo C++ 3.0 for DOS. I'm using it to
> write a program that plays Checkers. This requires a tree search using a
> recursive MiniMax algorithm.

> If I set the maximum number of plies of the tree to a fairly small
> number, it ran fine. However, I tried iterative deepening of the code to
> get it to find forced wins in the endgame better -- and started getting
> an exception error (I'm running this is a DOS window under WIN 95). I
> suspected stack overflow. Sure enough, when I turned on overflow
> checking in the compiler, I get a stack overflow at somewhere between
> 2-4 plies nearly every time. It will normally run okay even at higher
> plies if I turn stack checking off, but this clearly isn't something I
> can just ignore.

> I was given the compiler/de{*filter*}/IDE, but I don't have the
> documentation for it. Here is the map file that the linker puts out. It
> looks like I'm getting only 128 bytes for the stack, so the problem is
> certainly no major surprise. I'd appreciate it if anyone with experience
> with this package could give me some advice on how to a)increase the
> size of the stack and b)reduce stack usage. Please address your reply to

> Thanks,
> Bruce

<Jack>

You will probably get the best answers to Borland compiler specific questions

a 16 bit x86 program can't have more than 64 Kbytes of stack space no matter
what you do.  This is a limitation of the hardware architecture.

If you're running Win95 you might want to get a 32 bit compiler and forget
about the tiny 16 bit mode memory limitations.  You might check out
www.delorie.com for a 32 bit freeware compiler.

</Jack>



Wed, 14 Mar 2001 03:00:00 GMT  
 Stack overflow help sought

Quote:
> A friend gave me an old copy of Turbo C++ 3.0 for DOS. I'm using it to
> write a program that plays Checkers. This requires a tree search using a
> recursive MiniMax algorithm.

> ....

> I'd appreciate it if anyone with experience
> with this package could give me some advice on how to a)increase the
> size of the stack and b)reduce stack usage. #ifdef __MSDOS__

To increase the stack size just add the following code to your program:

  //-- Set stack to 10K (for Windows we would use the DEF file)
  extern unsigned _stklen = 10240;
  #endif

Jussi Jumppanen
Author of: Zeus for Windows, Win32 (Brief, WordStar, Emacs) Text Editor
"The C/C++, Java, Pascal, Cobol, fortran programmers text editor"
Home Page: http://ourworld.compuserve.com/homepages/jussi/



Thu, 15 Mar 2001 03:00:00 GMT  
 Stack overflow help sought
Groovy hepcat Bruce Bowman (remove NOSPAM to reply) was jivin' on Sat,
26 Sep 1998 13:23:05 -0400 in comp.lang.c.
Stack overflow help sought's a cool scene! Dig it!

Quote:
>A friend gave me an old copy of Turbo C++ 3.0 for DOS. I'm using it to
>write a program that plays Checkers. This requires a tree search using a
>recursive MiniMax algorithm.
>If I set the maximum number of plies of the tree to a fairly small
>number, it ran fine. However, I tried iterative deepening of the code to
>get it to find forced wins in the endgame better -- and started getting
>an exception error (I'm running this is a DOS window under WIN 95). I
>suspected stack overflow. Sure enough, when I turned on overflow

  This is off topic for comp.lang.c, being an issue about a particular
system and compiler. Try a group that deals with your brand of
compiler or OS, such as comp.os.msdos.programmer.
--

----- Dig the EVEN NEWER, MORE IMPROVED news sig!! -----

-------------- Shaggy was here! ---------------
    http://aardvark.apana.org.au/~phaywood/
============= Ain't I'm a dawg!! ==============



Fri, 16 Mar 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Stack Structure and Stack Overflow for CE

2. stack overflow help?

3. stack overflow help

4. C++ Builder Stack Overflow Error - Please help - Need to know how to overcome this Debugger Exception

5. Help! Stack Overflow in Recursive

6. HTML help gives a stack overflow?

7. Help! Stack Overflow in Recursive

8. need help with stack overflow

9. Stack Overflow ( HELP PLEASE )

10. 3 lines c code has stack overflow, help !

11. VC++ 1.52 Stack Overflow problem pls Help !!!

12. Stack overflow exception

 

 
Powered by phpBB® Forum Software