I know that Windows 32-bit allows for any process about 2 Gigabyte memory address space as a maximum. 2 Gigabytes = 2147483648 bytes. I tried to allocate heap memory much more than 2147483648 bytes and I saw no error or exception, this the code:
# include<iostream>
int main(){
void *x=malloc(2147489999);
free(x);
system("pause");
return 0;
}
what is the reason?
You’re not checking the return value 🙂