Re: Memory Allocation Tracking

From: George (greerga@CIRCLEMUD.ORG)
Date: 01/08/98


On Wed, 7 Jan 1998, Gary Barnett wrote:

>As you will no doubt see, the free call is not returning the
>correct amount of memory that will be freed. I deduce this from
>two clues: 1) PS and the memory alloc stat get farther apart in
>value as time passes  2) Creating 200 objs in a room and then purging
>them does not decrease the amount of memory allocated. In fact, it goes
>up..

One reason may be that you're taking the size of the pointer.  Another may
be that all the 'char *' variables return 4.

Not sure how you would do it without keeping track of allocations yourself
or using one of the internal libc malloc functions.  malloc_usable_size()
from glibc 2.0.6 would have been a nice one if it wasn't an internal
function.  (It would be extremely useful in verifying that the pointer is
dynamically allocated memory too!)

Maybe we should all gripe to the creators of it so we can use that.
(And malloc_check, realloc_check, free_check, etc, etc.)

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | 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