[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-gcc
Subject:    Re: arrays that are too big
From:       Fenglou Mao <mao () csb0 ! IPC ! PKU ! EDU ! CN>
Date:       1999-08-27 1:09:37
[Download RAW message or body]


If you don't use "static", your array is allocated in the call stack, I 
think, "static" also make your array allocated in the globe memory. You 
can write a small program, it has a large array, a loop asign value to 
all the elements, then you can find the difference. 
In slackware3.4, gcc 2.7.2, largest array is about 8M if no "static",
it can reach your "physical memory" + "virtual memory" size if you use 
"static".

> 
> 
> Fenglou Mao wrote:
> 
> >     static float array[10000000];
> >     ^^^^^^
> 
> IIRC, static applied to a global valiable means that the variable can be used
> only in the current module. So static affects the scope of the variable, and
> has nothing to do with memory allocation. `static int v[100]' is the same with
> `int v[100]' in a single module program. If static is applied to a local
> variable in a function, then the variable is preserved between different
> calls.
> In the matter of the init of the array, if the program loads then the array is
> ok. (arrays generally exist within the program -
> except if you use -fconserve-space wich is a different case)
> 
> Bye.
> --
> Send money to god@heaven.com and prayers to god@heaven.org
> For the latest version of the Bible (currently 3.5.18) do a ftp
> at ftp.heaven.com, username: religious_one, password: god_rules
> And remember: God uses Linux2.
> 
> 

Sincerely Yours,

FengLou Mao
*******************************
ADD:Mr. FengLou Mao
    Peking University
    BeiJing
    P.R.China
Tel:86-10-62751490
Fax:86-10-62756833

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic