I have written a small program just to check if my program can acquire entire RAM of my PC. i am trying to allocate 4 GB. When i check with task manager it shows around 2 GB. i believe OS has some kind of memory management mechanism. If someone can provide me what is really happening it will be helpful for me. [i am not taking care of memory leak as this is a test code]
int main()
{
char* p;
p = (char*)malloc((1024 * 1024 * 1024));
p = (char*)malloc((1024 * 1024 * 1024));
p = (char*)malloc((1024 * 1024 * 1024));
p = (char*)malloc((1024 * 1024 * 1024));
while (1){}
return 0;
}
Thanks in Advance,
Sagar