Is the malloc return value a virtual or physical address?

Is the address returned by malloc a virtual address, or is it the actual physical address to which the memory is allocated?

Edit:

I read somewhere, "In some implementations, calling free () frees memory back to the system, and in others to the process." “Return to system” means that memory is actual physical memory, and “exemption from the process” means that it is virtual memory?

+3
source share
3 answers

This is the address valid in the current process. Regardless of whether the virtual address or physical address depends on the underlying platform.

+14
source

C , . , .

. , , .

, , - , . C , , , .. , , .

(1, 2, 3,...), , , . , , .

+3

, , , - - ... - -, malloc(). , , - UNIX /dev/mem - , , , .

0

Source: https://habr.com/ru/post/1770044/


All Articles