Recently I noted that the loaded (ld) allocates memory that I've
declared in large static arrays in fortran programs.
I wrote a simple short C program that exhibits the same problem (or
perhaps it's a new feature):
gcc -o ldhog ldhog.c
will (depending how much memory you have, and how big N is) sit there
for quite some time.This version uses a little over 500MB.
In previous versions of ld, this was not a problem, but somehow now it
is. Perhaps this is a bug fixed in Ubuntu 11 ?
I am running this on 10.10.
AFAIK, the array is uninitilized data, and indeed, the size command
shows up with 500+ MB in the .bss section of the executable.
So it's beyond me why ld should allocate that space and do something
with it.
Anybody have an idea what's going on here?
peter
/* ldhog.c : */
#include <stdio.h>
#define N 512
/* for big N ld will now go and allocate this space ??? */
static float biga[N][N][N];
void main(void) {
float sum = 0.0;
int i,j,k;
for (i=0; i<N; i++) {
for (j=0; j<N; j++) {
for (k=0; k<N; k++) {
biga[i][j][k] = 0.0;
sum += biga[i][j][k];
}
}
}
printf("N=%d sum=%f
",N,sum);
}
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users