Re: How does free() know how many bytes to free???
- From: Wolfgang Draxinger <wdraxinger@xxxxxxxxxxxxxxxx>
- Date: Tue, 27 Nov 2007 10:06:11 +0100
MAx wrote:
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?
Upon malloc, the size of the buffer is stored somewhere, normally
sizeof(ptrsize_t) bytes before the beginning of the allocated
area, but this may largely differ by the implementation. A
ptr->buffer_length lookup table may be used as well.
Have a look at the source code of your libc.
Wolfgang Draxinger
--
E-Mail address works, Jabber: hexarith@xxxxxxxxxx, ICQ: 134682867
.
- Follow-Ups:
- Re: How does free() know how many bytes to free???
- From: Paul Pluzhnikov
- Re: How does free() know how many bytes to free???
- References:
- Prev by Date: How does free() know how many bytes to free???
- Next by Date: Re: How does free() know how many bytes to free???
- Previous by thread: How does free() know how many bytes to free???
- Next by thread: Re: How does free() know how many bytes to free???
- Index(es):
Relevant Pages
|