title: How does a program know how much memory to release?
body: <p>I suspect the answer to my question is language specific, so I'd like to know about C and C++. When I call <code>free()</code> on a buffer or use <code>delete[]</code>, how does the program know how much memory to free?</p>
  
  <p>Where is the size of the buffer or of the dynamically allocated array stored and why isn't it available to the programmer as well?</p>