delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/30/05:26:23

Date: Sun, 30 May 1999 12:21:11 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Brian Ronk <rithe AT mailcity DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: errors
In-Reply-To: <AGHKDJHCGJPJCAAA@mailcity.com>
Message-ID: <Pine.SUN.3.91.990530122052.12571X-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sat, 29 May 1999, Brian Ronk wrote:

> I have been recieving an error that I am assuming is a memory error.
> My program starts up, but never actually runs anything.  It quits
> with a 255 code, with a message about SIGSEGV.  I found out what in
> my program was causing the error.  I declared an array of size 50 of
> a type that was about 230444 bytes large. (it is a map class if you
> are wondering) I figured out that this won't work on my computer
> since that needs about 11 megs of memory

Is the array automatic?  In other words, is it declared inside one of
the functions?

If so, then you are trashing the run-time stack, which is by default
512KB and cannot be enlarged after the program starts.  See section
15.9 of the FAQ for more details.

Generally, for such large arrays, it is a bad idea to declare them
automatic.  Instead, allocate the storage at run time using `malloc'.
Then you have all the virtual memory at your disposal.

- Raw text -


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