We know that a process memory space is limited by 4G (1G for kernel).
I am thinking if I can malloc a space larger than 3G. So I tried the following:
AND It works! But the print out result isn't that nice.....Code:int main() { char* x = (char*)malloc(3*1024*1024*1024); memset(x,'m',3*1024*1024*1024); printf("%s",x); return 0; }
Anybody knows why?
I also tried
This time compiler complains for its size. So I guess the implementations of malloc and char[] are different, right?Code:char x[0x7fffffff];