delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/02/06/05:30:27

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: eplmst AT lu DOT erisoft DOT se (Martin Stromberg)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Help! Can't allocate 512KB static array??
Date: 6 Feb 2002 10:12:11 GMT
Organization: Ericsson Erisoft AB, Sweden
Lines: 31
Message-ID: <a3qvhr$fgv$1@antares.lu.erisoft.se>
References: <76c7896d DOT 0202060135 DOT 4fbf94e9 AT posting DOT google DOT com>
NNTP-Posting-Host: lws256.lu.erisoft.se
X-Newsreader: TIN [version 1.2 PL2]
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Damon Hastings (damonhastings AT yahoo DOT com) wrote:
: Can anyone tell me why the following program fails under djgpp on my
: machine?

: main() {
:   char foo[524273];
:   for (int i=0; i<524273; i++) foo[i] = 0;
: }

foo isn't static, it's automatic.

: Pretty simple, right?  Well, it sometimes throws a SIGSEGV fault,
: sometimes locks up, sometimes provokes Windows to pop up an
: application termination dialog, and sometimes spontaneously reboots
: the computer.  Similar results under DOS.  It works for an array size
: of 524272 or if I use malloc() or new instead of a static array.  I
: get the same result if I use int[131069] or if I break it into several
: smaller arrays.

: So I'm guessing this all means djgpp has a 512K stack limit, right? 

Yes.

: How do I change this limit?  Or do I have no choice but to use the

FAQ 15.9.


Right,

						MartinS

- Raw text -


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