Re: Memory Allocation Tracking

From: Erwin S. Andreasen (erwin@PIP.DKNET.DK)
Date: 01/09/98


On Fri, 9 Jan 1998, d. hall wrote:


> void my_free (void *mem)
> {
> #ifdef FREE_IS_BROKEN
>    if (mem != NULL)
> #endif
>       free (mem);
>
>    statistics.mem_alloc -= sizeof (*mem);

You can't take sizeof(void); (that gcc allows you to is a gcc extension).
But anyway, this wouldn't quite do anything useful, since it would give
always the same size back no matter what pointer was passed to the
function.

If you want to do this, you have to do it in the macro: but, as I wrote
before, it will work only pointers to single structures only, not multiple
ones.


 =============================================================================
Erwin Andreasen   Herlev, Denmark <erwin@pip.dknet.dk>  UNIX System Programmer
<URL:http://www.abandoned.org/drylock/>     <*>         (not speaking for) DDE
 =============================================================================


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST