delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/06/16/08:30:38

From: Hans-Bernhard Broeker <broeker AT physik DOT rwth-aachen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Program
Date: 16 Jun 2003 08:52:10 GMT
Organization: Aachen University of Technology (RWTH)
Lines: 30
Message-ID: <bck0fq$g0j$1@nets3.rz.RWTH-Aachen.DE>
References: <3 DOT 0 DOT 1 DOT 16 DOT 20030615182018 DOT 34b7942a AT earthlink DOT net>
NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de
X-Trace: nets3.rz.RWTH-Aachen.DE 1055753530 16403 137.226.32.75 (16 Jun 2003 08:52:10 GMT)
X-Complaints-To: abuse AT rwth-aachen DOT de
NNTP-Posting-Date: 16 Jun 2003 08:52:10 GMT
Originator: broeker@
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Ethan Rosenberg <ethros AT earthlink DOT net> wrote:

> Can you help??

> MUCH THANKS IN ADVANCE.

The problem, I think, is that you're blowing your stack by too many,
too large automatic arrays.  I.e.:

[...]
> #define FFT_LEN     16384
[...]
> void stuff2(complx wave[])
> {
>     int i,limit,j,jj;
>     complx temp[FFT_LEN];
>     complx temper6[FFT_LEN];
>     complx temper7[FFT_LEN];        

These are 3*16384*2*4 (or 8, if cmplx is made of doubles), or a total
of about 400K of stack memory usage.  And they're not the only arrays
of this size your code uses, and which are all of storage class
"automatic".

Don't put such large objects on the stack.  They should always be
allocated statically, or dynamically (using malloc() / new).

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