FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

LinkBack Thread Tools
Old 06-27-2011, 04:58 PM
Peter Teuben
Default ld a memory hog on Ubuntu 10/11?

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?


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

ubuntu-users mailing list
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

Thread Tools

All times are GMT. The time now is 06:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org