delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/05/14:32:42

Date: Thu, 05 Jul 2001 21:28:41 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: Andreas Dorn <adorn AT ix DOT urz DOT uni-heidelberg DOT de>
Message-Id: <7263-Thu05Jul2001212841+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <3B447193.E7BA25AB@ix.urz.uni-heidelberg.de> (message from
Andreas Dorn on Thu, 05 Jul 2001 15:54:27 +0200)
Subject: Re: Large Arrays
References: <3B447193 DOT E7BA25AB AT ix DOT urz DOT uni-heidelberg DOT de>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Andreas Dorn <adorn AT ix DOT urz DOT uni-heidelberg DOT de>
> Newsgroups: comp.os.msdos.djgpp
> Date: Thu, 05 Jul 2001 15:54:27 +0200
> 
> I need a really large array for a matrix (~100 MB).
> With linux/unix and gcc that worked fine, but with dos/windows this
> never worked. Even with 256MB RAM and "small" arrays (<5MB) it didn't
> work.
> 
> The initialisation of the array looks like this:
> 
> int main(void)
> {
>   const int Dimension=5000;
> 
>   float TheMatrix[Dimension][Dimension];
>   int i,j;

Your program is blowing up the run-time stack, which by default is
only 512KB large.  See section 15.9 of the DJGPP FAQ list for more
details.

> - I don't have much experience with dos/windows compilers. What is the
> reason for the memory-problems? And how much memory do I get for an
> array under win3.11, win95, ..?

The amount of available memory can be seen by running the go32-v2
program with no arguments.  A typical Windows system lets you use at
least 64MB of memory; if you have more than 64MB physical memory
installed, Windows will let you use up to the amount of the installed
memory.

Chapter 15 of the FAQ has more about this.

> - Is there an easy solution (a compiler option or something) to get a
> working array?  (option: -WA <working array> :-))

You can stubedit the executable for a larger stack, or you can
allocate the array at run time with malloc.  Again, the FAQ has the
details.

- Raw text -


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