3 ms·
Should the question be like this? "Can a program ~~allocate~~ use more memory than is physically available on the server (assuming no swap)?" Because, malloc al
by prabhu-yu 5y ago
Should the question be like this?
"Can a program ~~allocate~~ use more memory than is physically available on the server (assuming no swap)?"
Because, malloc allocates from virtual memory, not from the physical memory. Only when we access the the memory explicitly by read/write for the first time, then the page fault happens and page allocation begins. If page can't be allocated, then program gets terminated with a SIGNAL.
Here, malloc was successful since allocation from VM was successful. But that is no guarantee that we have all memory we got. We can still run out of memory even though we allocated everything at start of program... It is so un predictable ...
So, I assume, your question is asked with above intention.
Please correct me if I am wrong. Your question and whole thread made me to think!
-p