max size of automatic arrays?

Pekka Nousiainen peno at enea.UUCP
Tue Dec 10 19:10:29 AEST 1985


>>main()
>>{
>>	double humongous[200000];
>>
>>memory fault -- core dumped

>data is on the stack.  When the stack is expanded slowly, ie through routine
>calls with small amounts of auto data memory faults occur.  The kernel notices
>that the fault is close to current stack limit and expands the stack figuring

On Genix (tm?) and probably other systems too, the kernel checks if the
instruction causing the fault is ENTER (enter a function).  If it is, any
memory reference is allowed.  The core dump is caused by a software or a
physical limit, sort of like using malloc(200000) and not checking the return
value.  But in this example no check is possible (except SIGSEGV).

--
...!mcvax!enea!peno.



More information about the Comp.lang.c mailing list