delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/03/28/16:16:52

From: "Greg Donnells" <gad AT donnesys DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <3ac02f4b$0$14446$272ea4a1 AT news DOT execpc DOT com> <Um7w6.1128$eX4 DOT 241968 AT typhoon DOT tampabay DOT rr DOT com> <l48w6.369$083 DOT 262866 AT typhoon DOT tampabay DOT rr 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: <O2sw6.2649$083.1329654@typhoon.tampabay.rr.com>
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.
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019