Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site lll-crg.ARpA Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!ucbvax!ucdavis!lll-crg!brooks From: brooks@lll-crg.ARpA (Eugene D. Brooks III) Newsgroups: net.lang.c,net.unix Subject: Re: max size of automatic arrays? Message-ID: <1126@lll-crg.ARpA> Date: Sun, 8-Dec-85 16:26:52 EST Article-I.D.: lll-crg.1126 Posted: Sun Dec 8 16:26:52 1985 Date-Received: Mon, 9-Dec-85 06:29:46 EST References: <627@ttrdc.UUCP> Reply-To: brooks@lll-crg.UUCP (Eugene D. Brooks III) Organization: Lawrence Livermore Labs, CRG Group Lines: 20 Xref: watmath net.lang.c:7348 net.unix:6566 >main() >{ > double humongous[200000]; > write(2,"A OK\n",5); > .... >} > >which compiled OK but on an attempt to invoke got me an immediate: > >memory fault -- core dumped I have run into this problem before on Unix systems. The problem is that the data is on the stack. When the stack is expanded slowly, ie through routine calls with small ammounts of auto data memory faults occur. The kernel notices that the fault is close to current stack limit and expands the stack figuring that the user wants to expand the stack. If the user however expands the stack by several meg in one shot, as with a large auto array, the kernel has no way of knowing that the fault is just a stray pointer and assumes that it is. The limit for this change in strategy is probably set in the kernel somewhere and you could probably change it if you want.