delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/04/22/08:45:04

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Trouble of using very large arrays
Date: 22 Apr 2004 12:35:44 GMT
Lines: 20
Message-ID: <c68e70$96gqq$1@ID-231750.news.uni-berlin.de>
References: <c68d6j$g57$03$1 AT news DOT t-online DOT com>
NNTP-Posting-Host: ac3b07.physik.rwth-aachen.de (137.226.33.205)
X-Trace: news.uni-berlin.de 1082637344 9651034 D 137.226.33.205 ([231750] 10357)
X-Orig-Path: not-for-mail
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Mok-Kong Shen <mok-kong DOT shen AT t-online DOT de> wrote:

> I have difficulty in using very large arrays. In a
> simple program I could have 'unsigned int a[70000][2]'
> without problem but with 'unsigned int a[80000][2]' the
> program aborts without even the code being changed to
> access the increased new part of the array. Why is
> this so? Thanks in advance.

You don't provide all the necessary details for anyone to be sure, but
this very strongly feels like you're blowing the stack.  Don't make
large variables like this automatic (i.e. local to some function).
The usual recommended solution is to use the heap instead of the
stack, i.e. use 'new' or malloc(), depending on what language you're
working in, or make such variables static.


-- 
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