3 ms·
Allocated "space", i.e., virtual memory space. Malloc allocates virtual memory space, not physical RAM.
by klodolph 7y ago
Allocated "space", i.e., virtual memory space. Malloc allocates virtual memory space, not physical RAM.
- mehrdadn 7y agoC has no notion of virtual memory. If memory is allocated for you that means you can read and write to it.
- foo101 7y agoThere is no guarantee offered by the standard that you must be able to read and write to memory allocated by malloc(). What if the memory was allocated and just a split second later, the physical RAM burnt out due to overheating? How is the standard supposed to guarantee reading and writing to it then? Both the hardware burning after memory allocation and lack of availability of physical memory after memory allocation are outside the scope of the standard. The standard says nothing about them. A C program can fail in these scenarios without violating the standard.