Limit to array size under cc?

Richard A. O'Keefe ok at quintus.UUCP
Sun Jan 24 12:32:28 AEST 1988


In article <594X at esunix.UUCP>, rushfort at esunix.UUCP (Kevin Rushforth) writes:
> This is not a limit on the size of an array imposed by your compiler,
> but rather a limit on the stack size imposed by your OS.  4.2/4.3 based
> Unix systems (as well as others) have compiled in limits on stack size
> (the csh command "limit" will tell you how much).

The limit is not compiled-in.  (There may be a compiled-in limit, but
the number Csh will tell you is usually well below it.)  For example,
	% limit stacksize
on my machine just now reported
	stacksize       512 kbytes
I then said
	% limit stacksize 2M
and it raised the limit to 2 megabytes.  This isn't really a good idea.
4BSD systems also have a rather nice function
	alloca(size)
allocates that much space in the stack; it will go away when the
calling function returns.  The stack size limit applies to alloca()
as well as to explicitly declared arrays.



More information about the Comp.lang.c mailing list