Understanding the heap
Posted: Tue Sep 11, 2007 7:56 am
Hi everyone out there,
I am currently designing an operating system ,but i am planning to add some more and that will need from what i see ,dynamic memory allocation within the kernel itself.I am coding in standard C.
What i wish to do now is to code a malloc ,free and realloc function.
I am having problems understanding what actually is going on behind the scenes of these functions.My questions are:
-Where is the heap located for dynamic memory allocation?In my program's data area or is it elsewhere?
-How do i get a pointer to the heap if this is the case so i can allocate memory and if not the case,how do i then implement dynamic memory allocation?
Thanks to all out there.
I am currently designing an operating system ,but i am planning to add some more and that will need from what i see ,dynamic memory allocation within the kernel itself.I am coding in standard C.
What i wish to do now is to code a malloc ,free and realloc function.
I am having problems understanding what actually is going on behind the scenes of these functions.My questions are:
-Where is the heap located for dynamic memory allocation?In my program's data area or is it elsewhere?
-How do i get a pointer to the heap if this is the case so i can allocate memory and if not the case,how do i then implement dynamic memory allocation?
Thanks to all out there.