sivag9 wrote:
> hi, every body i have on doubt. My doubt is when we allocate memory 
> dynamically we uses malloc system call .For freeing we uses free
> system call.For ex:- ptr = malloc(10);
>  it allocates 10 bytes of memory  and
>   free(ptr);
>  it releases that memory ,my doubt is how free system call would knows
> how many bytes to free .I studied some where after allocating memory
> the adjacent cell contains the how many bytes it allocates .By using
> this free system call will works. My actual doubt is in my example
> after allocating 10 bytes , is 11'th byte contains the total bytes
> information?If not where total information resides? 

I have written a fairly decent description of memory allocation in Safe 
C++ Design Principles.  An e-book you should already be reading that is 
free for c-prog members (see the Files section of our YahooGroup 
website).  The chapter on Memory.

Paul's link is much more in-depth of how the allocator manages memory 
that the system allocated.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/

Reply via email to