On Wed, Mar 27, 2002 at 12:13:02AM +0000, kevin lyda mentioned:
> now for free to work, malloc has to do accounting. so each call
> requires malloc to record each location returned and the size of each.
> so somewhere there's a table that says 20(10), 30(5), 35(5), 40(10),
> 50(10). it might be an actual table or it might be just before the
> block allocated or whatever.
I may be wrong, but I don't think there is just a table, as such. when
you do;
malloc(50);
and it returns something like 0x23288322, it has actually put its
accounting info 32 bytes back, in 0x23288302. So, when you
free(0x23288322), it steps back 32 bytes, checks how much etc. and where,
and then marks the mini-allocation free, in the table.
As unix people, we should really know exactly how this works. Anyone care
to explain ?
Kate
--
_______________________________________
John Looney Chief Scientist
a n t e f a c t o t: +353 1 8586004
www.antefacto.com f: +353 1 8586014
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!