How does free() know how many bytes to free???



Hi,
A call to free() is used to de allocate memory which has been
allocated by a malloc()
or a calloc() call.
How does free() know how many bytes to deallocate?

Thanks in advance
.



Relevant Pages

  • Re: This calculation is just wrong / computer cant count!
    ... and I replied "new or malloc". ... It is not the fastest way to allocate memory". ... think that VirtualAlloc is faster than malloc has some serious issues, ... then there is no error only a precision limit. ...
    (microsoft.public.vc.mfc)
  • Re: difference between malloc and calloc?
    ... malloc(), and that's the opportunity for a tiny bit of sanity- checking. ... Here are two ways you might try to allocate memory to ... calloc() almost never. ... There is no special dispensation for overflow of nmemb * size; there is just the requirement for a NULL returned value. ...
    (comp.lang.c)
  • Re: difference between malloc and calloc?
    ... malloc(), and that's the opportunity for a tiny bit of sanity- checking. ... Here are two ways you might try to allocate memory to ... calloc() almost never. ... void *p = malloc; ...
    (comp.lang.c)
  • Re: Dynamic Allocation Problem.....
    ... malloc() to allocate memory for the Pointer variables. ... version you will see some debug output in this case. ...
    (microsoft.public.de.vc)
  • Re: malloc() for struct member
    ... Is it OK to allocate memory by mallocor callocfor a ... > int a; ... >struct mystruct myobject; ... Don't cast the return from malloc. ...
    (comp.lang.c)