Re:Malloc Never Fails (2012)
by mehrdadn on Monday June 10, 2019 @03:16PM
(#20149822)
Try 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.
[ Parent
| on HN ]
> 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.