COMPUTER SOFTWARE
OPERATING SYSTEMS
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
The memory returned by a call to malloc comes from the____
|
data segment
|
|
heap segment
|
|
text segment
|
|
stack segment
|
Explanation:
Detailed explanation-1: -All variables allocated by malloc (or new in C++) is stored in heap memory.
Detailed explanation-2: -Normally, malloc() allocates memory from the heap, and adjusts the size of the heap as required, using sbrk(2). When allocating blocks of memory larger than MMAP THRESHOLD bytes, the glibc malloc() implementation allocates the memory as a private anonymous mapping using mmap(2).
There is 1 question to complete.