Sathyaish said:
Thanks, Thomas and others. I want some more rigorous reading on this.
For instance, I could easily understand what Thomas Matthews said
because I knew it earlier plus I have some background of C and C++.
Where can I get more copious information on the internal working of
the heap?
The heap is a tool (data structure) used by some compiler vendors to
manage dynamic memory. An implementation is not required to have
a heap in order to be compliant with the standard.
The question now is whether you want copious information about:
1. Heap data structures
2. Memory allocation methods (schemes)
3. Compiler Theory.
I suggest using your favorite web search engine with the appropriate
keywords and see what you can find. I took and older route and took
classes in the above at the University. Many Universities give the
Computer Science people a Compiler to write as their final project.
As far as the C language goes, you can do three things with
dynamic memory:
1. Allocate from it.
2. Reallocate from it.
2. Deallocate objects to it (i.e. return or free already
allocated items).
Kind of simple and boring. You allocate memory as you need it
and dispose of the objects when you are finished with them.
Anything beyond this, such as alignment and memory collection,
is beyond the scope of this newsgroup.
PS: Thomas, haven't I seen you on JoS?
What is JoS?
I remember playing with an operating system called JOSS, but
that was a long time ago.
If you know me, you might remember that I really hate acroynyms.
Just as a picture is worth a thousand words, one never really
knows which of those thousand words the author/artist was meaning
to convey. I prefer to be explicit. So, WTF is JoS?
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq:
http://www.parashift.com/c++-faq-lite
C Faq:
http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book