What goes on stack?

William Roetzheim roetzhei at sdsu.UUCP
Fri Oct 21 01:16:51 AEST 1988


  Help!  I'm working with Turbo C version 1.5.  My program is large (about
30,000 lines) and deals with large arrays (static and dynamic) and many
string literals in the code.  The stack size required is huge.  Anything
less than about 55K for a stacksize causes a stack overflow on program
execution.  I've looked at the obvious:

	1.  I don't do any recursion;

	2.  I don't pass a huge number of paramaters to anything, maybe
	    an average of two or three paramaters;

	3.  The program is not heavily nested.  From a top level routine
	    down to the lowest level 'put a character to the screen' I 
	    probably have 15 levels of nesting.

  Other than return addresses, register values, and paramaters, what else
does Turbo C put on the stack?  What the heck would cause it to grow so 
big?  This really is a problem because Turbo C appears to allocate the stack
in the global data segment (is this true), thus leaving me no room for some
global data I want to work with.  Correct me if I'm wrong, but passing
arrays (including arrays of pointers) should be no problem because they
are passed by reference, thus costing only 4 bytes (I'm using the large
memory model).

  Any help would be appreciated.

William



More information about the Comp.lang.c mailing list