stack space

utzoo!decvax!ucbvax!menlo70!sri-unix!dan at BBN-UNIX utzoo!decvax!ucbvax!menlo70!sri-unix!dan at BBN-UNIX
Fri Jan 1 20:11:38 AEST 1982


From: Dan Franklin <dan at BBN-UNIX>
The problem with allocating that data on main's stack is that the size of the
stack can vary significantly depending on the size of the environment of the
person running the program and the argument list. If someone with a Concept 100
TERMCAP entry in their environment invokes a command with a starname that
matches lots of filenames, the stack could easily end up 1kb larger than
the implementer expected. Note that if the allocation is made even slightly too
large, the stack uses the whole next 8K segment, so you really lose big. One
way to get around this is to write a small assembly-language routine which will
enlarge the stack enough to leave 1k or so for lower-level C function stack
frames, and return the address and size of the area. Such storage could be
difficult to take full advantage of. On our 11/70 I wrote a prefree() routine
for alloc which inserted a given piece of storage into the arena for future
use; this seems like the most convenient way to make such "static automatic"
storage available. On the whole, though, changing estabur seems better (it's
certainly simpler to use!).



More information about the Comp.unix.wizards mailing list