>
> //********** 1 ***
> void foo(){
> char a[16384];
> foo();
> }
> void main(){
> foo();
> }
>
> //********** 2 ***
> void main(){
> void *i;
> while(1) i=malloc(16384);
> }
>
>
> Program #1 ends with a huge core dump.
> Program #2 ends with a core too, but it is very little, about 8MB.
> Strange.
First program places a[] on the stack. This stack is constantly being
referenced, so it is physically allocated.
The 2nd prog, i is not accessed, and linux does mem alloc in overcommit mode.
I think, anyways. I am no expert.
Adam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/