www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/05/11:00:18

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Large Arrays
Date: 5 Jul 2001 14:59:39 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 18
Message-ID: <9i1vcr$8op$1@nets3.rz.RWTH-Aachen.DE>
References: <3B447193 DOT E7BA25AB AT ix DOT urz DOT uni-heidelberg DOT de>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 994345179 8985 137.226.32.75 (5 Jul 2001 14:59:39 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 5 Jul 2001 14:59:39 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Andreas Dorn <adorn AT ix DOT urz DOT uni-heidelberg DOT de> wrote:

> I need a really large array for a matrix (~100 MB).

Fine. But you should re-think the way you're using to create it.

[.. inside main(): ..]
>   float TheMatrix[Dimension][Dimension];

This creates the matrix in the stack. That's bad, because the stack
has a fixed maximal size, on DOS/DJGPP (and several other platforms).
Use the heap, instead (--> 'new' or 'malloc'). Methods for creating 2D
dynamical arrays that still can be accessed by a[i][j] notation are in
the comp.lang.c FAQ.

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