delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/29/01:02:11

From: "A. Sinan Unur" <sinan DOT unur AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: "big" arrays
Date: Mon, 29 Dec 1997 00:55:23 -0500
Organization: Cornell University (http://www.cornell.edu/)
Lines: 22
Sender: asu1 AT cornell DOT edu (Verified)
Message-ID: <34A73B4B.A430C820@cornell.edu>
References: <01bd13ea$293d4c40$a8dcc7c7 AT suzie>
NNTP-Posting-Host: cu-dialup-0084.cit.cornell.edu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

mephisto wrote:
> 
> When you have a line like this "char MyArray[20000000];", DJGPP will
> attempt to allocate the array, but if you use implicit allocation(ie, 
> not using malloc or an equilavent) DJGPP won't make your program 
> crash. So, use malloc and test the results.

i have no idea what you mean here, but the difference is whether the
array is global or allocated on the stack. the default stack size for
djgpp programs is 256Kb, so a local array larger than that will corrupt
the stack, leading to a crash. you can either increase the size of the
stack, or, better IMO, allocate such a large amount of memory
dynamically.

-- 
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA

mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/

- Raw text -


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