Mail Archives: djgpp/2001/07/05/14:32:42
> 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 -