Typically, the C runtime will use various OS APIs to allocate memory, which is part of the process address space. Within the allocated memory, it creates a heap and allocates memory from this heap through calls to malloc or new .
The reason for this is that often the OS APIs are finely grained and require you to allocate memory in large fragments (such as page size), while your application usually wants to allocate small amounts of memory at any given time.
source share