[DGD]editor() and swapout() problems

Felix A. Croes felix at dworkin.nl
Thu Apr 15 16:23:44 CEST 1999


Mikael Lind <z94lind at mtek.chalmers.se> wrote:

> The first time any object on my mud calls editor() or swapout(), dgd
> prints out a lot of lines of what seems to be debugging messages. They
> look like: 
>
> FREE(000f122c/72), array.c line 1109:
>  03 01 'd '. 00 0f '8 cc 04 01 00 03 00 00 00 05 03 01 'd '. 00 0f '8 ', 04 01
> FREE(0010c644/48), array.c line 1109:
>  03 01 'e 'r 00 0f 'R 80 04 01 00 05 00 00 00 07 03 01 'Y ': 00 0f '> 98 04 01
> [...]

This is indeed a debug message, and there are two ways in which it
can occur.  The first is when you have arrays or mappings with
circular links in them, with the most simple case being:

    A = allocate(1); A[0] = A;

The circular reference may involve more than one array.  For example,
B[0] may be A and A[0] may be B.  Alternatively, the messages may be
caused not by a circular array reference, but by a memory leak in DGD.

The more telling FREE messages will be those which refer to strings,
since they will contain (part of) the string involved.  In case of
a memory leak, they will help track down the specific cause of the
leak.  Partially as a result of these messages, DGD does not have
any known memory leaks, so my guess is that in this case, there are
circular array references involved.

The messages are generated only when the kfun swapout() is called,
or when DGD decides on its own to perform a swapout for housekeeping
reasons.

When you are working with self-referential (circular) datastructures,
these messages can be ignored, but even so they may point to a
problem.  Self-referential datastructures cannot be freed using the
normal reference counting methods, so they may accumulate in memory
until a swapout is done.  Note that an object which contains such
datastructures may individually be swapped in and out several times
in normal operation, leaving behind a new copy of its self-
referential datastructures each time.  Thus, the FREE messages may
indicate that swapout() should be performed more often, or that an
alternative solution should be found that does not use self-
referential datastructures, or that the circular links in the
datastructure should be broken before the data is discarded.

If you just want to be rid of the messages, compile array.c without
defining the macro DEBUG.

Regards,
Dworkin

List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list