Possible Duplicate:
How is heap and stack memories managed, implemented, allocated?
Hi, my question is about heap, not the data structure, but the area of memory that is used for dynamic memory allocation.
Suppose we're writing a program in C (or maybe C++) and somewhere in the depths of its code a call to malloc() is made (or operator new is invoked, in case of C++). Now what is the location of the allocated memory? Does the compiler (linker?) add a data segment that is used as a heap? How is the size of that segment determined? What will happen if we try to allocate a chunk of memory that is bigger than the entire "heap segment"? Will the heap be expanded? If yes, how?