Re: C out-of-bound pointer question

2007-11-16 Thread Dag-Erling Smørgrav
Oliver Fromme [EMAIL PROTECTED] writes: It is true that the k[] array in v2.0 uses 1 GB of mapped memory, *BUT* it does not use 1 GB of RAM. It only uses one page of physical RAM. Remember that RAM is allocated dynamically when it is accessed for the first time, so if you never access

C out-of-bound pointer question

2007-11-15 Thread deeptech71
int x[N]; Values in x[] are (rand()%10)+268435410, aka 268435410..268435419. The algorith counts each individual value. // v1.0 uses if( x[n] == ___ )'s // v2.0: int k[268435420] = {0}; // k uses almost 1GB of memory for (n = 0; n N; n++) { k[ x[n] ]++; } // v2.1: int k[10] = {0};

Re: C out-of-bound pointer question

2007-11-15 Thread Oliver Fromme
[EMAIL PROTECTED] wrote: int x[N]; Values in x[] are (rand()%10)+268435410, aka 268435410..268435419. The algorith counts each individual value. // v1.0 uses if( x[n] == ___ )'s // v2.0: int k[268435420] = {0}; // k uses almost 1GB of memory for (n = 0; n N; n++) {

Re: C out-of-bound pointer question

2007-11-15 Thread Simias
[EMAIL PROTECTED] writes: int x[N]; Values in x[] are (rand()%10)+268435410, aka 268435410..268435419. The algorith counts each individual value. // v1.0 uses if( x[n] == ___ )'s // v2.0: int k[268435420] = {0}; // k uses almost 1GB of memory for (n = 0; n N; n++) { k[ x[n] ]++;