Re: Is there heap size limitaion?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message -----
From: Andrew Haley <aph@xxxxxxxxxx>
Date: Friday, January 2, 2009 11:50 am
Subject: Re: Is there heap size limitaion?

> Anna Sidera wrote:
> > 
> 
> > From: Andrew Haley <aph@xxxxxxxxxx>
> 
> > 
> >> Anna Sidera wrote:
> >>> -----  -----
> >>> From: Andrew Haley <aph@xxxxxxxxxx>
> 
> >>>> Anna Sidera wrote:
> >>>>> Can you tell me if there is heap size limitation in gcc? I 
> use 
> >> a 
> >>>> server with 4 CPU and 16 BG ram. I create tables using malloc 
> >> and 
> >>>> the total memory I can use is a little less than 4 GB.
> >>>>
> >>>> Seems odd.  What OS / architecture are you using?
> >>> I am using unix. SunOS 5.10
> >> OK, but what architecture?  32-bit or 64-bit mode?
> >>
> >> Type
> >>
> >> isainfo -v
> >>
> >> If it's 32-bit then you will be limited, obviously.
> >> If gcc is generating 32-bit executables then you will also be
> >> limited.  The -m64/-m32 options control this.
> 
> > isainfo -v gives the following output:
> > 
> > 64-bit sparcv9 applications
> >         vis2 vis
> > 32-bit sparc applications
> >         vis2 vis v8plus div32 mul32
> 
> So, did compiling with -m64 fix it?
> 
> Andrew.
> 
> 
-m64 did not work. For the following program if I use -m32 the fist printf statement works but before the second one I get core dump. If I use -m64 I get core dump before the first printf.

#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
int main()
{

int i, j;

int **table1=malloc(10000000*sizeof(int));
int *table1_aux=(int *)malloc(10000000*100*sizeof(int));
for (i=0; i<10000000; i++) table1[i]=table1_aux+i*100;
for (i=0; i<10000000; i++) {
	for (j=0; j<100; j++) {
		table1[i][j]=0;
	}
}
printf("table1 ok\n");

int **table2=malloc(10000000*sizeof(int));
int *table2_aux=(int *)malloc(10000000*100*sizeof(int));
for (i=0; i<10000000; i++) table2[i]=table2_aux+i*100;
for (i=0; i<10000000; i++) {
	for (j=0; j<100; j++) {
		table2[i][j]=0;
	}
}
printf("table2 ok\n");

return 0;
}

Anna


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux