From: "Greg Donnells" Newsgroups: comp.os.msdos.djgpp References: <3ac02f4b$0$14446$272ea4a1 AT news DOT execpc DOT com> <99t0pm$k1n$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> Subject: Re: Hunting Sigsev Errors Lines: 20 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Message-ID: Date: Wed, 28 Mar 2001 20:44:30 GMT NNTP-Posting-Host: 24.164.23.148 X-Complaints-To: abuse AT rr DOT com X-Trace: typhoon.tampabay.rr.com 985812270 24.164.23.148 (Wed, 28 Mar 2001 15:44:30 EST) NNTP-Posting-Date: Wed, 28 Mar 2001 15:44:30 EST Organization: RoadRunner - TampaBay To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Would declaring the variable as a global (thus moving it's storage allocation to the data segment as opposed to the stack segment) also correct this scenario? > This is, as you suspected, your problem. You've just allocated > ARRAYMAX times 516 bytes, or 516 KB of memory, on the stack. That's > more than the default size of the whole stack, and will, indeed, cause > a solid crash. > > For such large memory blocks, you should never rely on the stack > (i.e. automatic variables) to contain them. Use heap storage instead, > i.e. malloc() and friends. > > -- > Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) > Even if all the snow were burnt, ashes would remain. >