public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* RE: dimensioned data
       [not found] <616BE6A276E3714788D2AC35C40CD18D2C51A1@whale.softwire.co.uk>
@ 2002-01-09  3:46 ` Rupert Wood
  0 siblings, 0 replies; 3+ messages in thread
From: Rupert Wood @ 2002-01-09  3:46 UTC (permalink / raw)
  To: 'Alessandro Mori'; +Cc: gcc-help

Alessandro Mori wrote:

> I am using gcc and g77 over large array with fixed dimension. I have
> not problem using malloc(), but using a fortran code I can only use
> a dimensioned data with much less elements (somethings like
> 68,000,000 complex*8 elements over a 2GB Ram system). A similar
> problem arise with C, as in the attached code.

I can't speak for the Fortran case. However, when you 'dimension' a
local array in C then it allocates temporary storage from the program
stack wheras malloc() allocates memory from the heap.

It's up to your operating system how much stack space you're allowed;
presumably you're stepping over the limit. It's probably safest to
explicitly malloc/free large storage.

Rup.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: dimensioned data
  2002-01-09  3:24 Alessandro Mori
@ 2002-01-14 15:28 ` Toon Moene
  0 siblings, 0 replies; 3+ messages in thread
From: Toon Moene @ 2002-01-14 15:28 UTC (permalink / raw)
  To: Alessandro Mori; +Cc: gcc-help

Alessandro Mori wrote:

> I am using gcc and g77 over large array with fixed dimension. I have not
> problem
> using malloc(), but using a fortran code I can only use a dimensioned
> data with
> much less elements (somethings like 68,000,000 complex*8 elements over a
> 2GB Ram
> system). A similar problem arise with C, as in the attached code.
> Compiled on my system (gcc 2.96) RH7.1 it gives a core dumped.
> Could you help me?

Two different problems.  The Fortran one is because of a limitation in
the Fortran front-end that will be removed in gcc/g77-3.1 (due April
15th).   See the news item in my signature.  The C one is caused by the
limit on stack usage been overrun.  This is an OS limitation - see the
documentation of Red Hat 7.1 on how to increase the available stack size
to a program.

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* dimensioned data
@ 2002-01-09  3:24 Alessandro Mori
  2002-01-14 15:28 ` Toon Moene
  0 siblings, 1 reply; 3+ messages in thread
From: Alessandro Mori @ 2002-01-09  3:24 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

Hi,

I am using gcc and g77 over large array with fixed dimension. I have not
problem
using malloc(), but using a fortran code I can only use a dimensioned
data with
much less elements (somethings like 68,000,000 complex*8 elements over a
2GB Ram
system). A similar problem arise with C, as in the attached code.
Compiled on my system (gcc 2.96) RH7.1 it gives a core dumped.
Could you help me?
Thanks in advance,

Alessandro Mori


[-- Attachment #2: pippo.c --]
[-- Type: text/plain, Size: 252 bytes --]

#include <stdlib.h>
#include <stdio.h>

#define DIM 10000000

int main()
{
  int i;
  char array[DIM];

  for(i=0;i<DIM;i++)
    array[i]='g';

  printf("%d:%c, %d:%c, %d:%c\n",0,array[0],DIM/2,array[DIM/2],
         DIM-1,array[DIM-1]);

  exit(0);
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-14 23:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616BE6A276E3714788D2AC35C40CD18D2C51A1@whale.softwire.co.uk>
2002-01-09  3:46 ` dimensioned data Rupert Wood
2002-01-09  3:24 Alessandro Mori
2002-01-14 15:28 ` Toon Moene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).