4 ms·
The space IS allocated, it's just that this space (virtual memory) is not backed by physical RAM.
by klodolph 7y ago
The space IS allocated, it's just that this space (virtual memory) is not backed by physical RAM.
- mehrdadn 7y agoTry telling that to the C standard. It has no notion of virtual or physical memory. If it's allocated that means you can read/write to it, end of story.
- brianfen 7y ago> It has no notion of virtual or physical memory. Exactly! That's why once virtual memory is allocated, malloc() is allowed to consider the operation successful. The standard does not care at all whether it is virtual memory allocation or physical memory allocation. It is completely unspecified in the standard what sort of memory must be allocated. So no spec in the standard is being violated by returning non-null pointer for virtual memory allocation.
- deleted 7y ago[deleted]