[DGD] Memory usage in 1.2p2

tavise at nwlink.com tavise at nwlink.com
Thu Mar 13 21:26:12 CET 2003


Let me preface my plea for help with this:  I'm sure the LPC we're running
has done something horrifically wrong, I just can't track down what.

OS: Linux 2.4.18-3

I have a mudlib written on top of MudOSAlike4DGD v1.1, as it was
originally written for MudOS.  It was much simpler to port to DGD using
that mudlib, which is quite bloated, but servicable.  The game currently
runs in DGD v1.1.92, and has run quite well for some time now (over a year
at least)

I recently have been forced to move servers, and am taking the opportunity
to upgrade to DGD 1.2.  Everything seems to be working marvelously, except
for one problem.  There is some functionality that walks through all the
user save files in the game, and updates some cache information within the
game.  Note: the functionality doesn't do this all as part of one
contiguous segment of work, but splits it out in several recursive
call_outs with wait times so that it can be ran without smoking the
machine for several minutes.

Under 1.1.92 this works fine, under 1.2p2 this causes memory usage to
increase until the server finally crashes with:

Fatal error: out of memory

I commented out all of the functionality that actually updated the cache
(so all the LPC code does is walk through the user save files and restore
them temporarily to an object) and the problem still occurs.

I put some debugging throughout this code, displaying the values from
status() in this manner:

string kb(int mem, int used) {
  return sprintf("%2.2f Mb (%2.2f%% used)",
                 (float)mem / 1048576.0,
                 ((float)used/(float)mem) * 100.0);
}
void show_status() {
  mixed *status;

  status = status();
  write("STATUS: static: "+ kb(status[ST_SMEMSIZE], status[ST_SMEMUSED]) +
       " dynamic: "+ kb(status[ST_DMEMSIZE], status[ST_DMEMUSED]) +"\n");
}

What I see when I run with the debug is this:

STATUS: static: 3.04 Mb (96.41% used) dynamic: 1.25 Mb (64.13% used)
STATUS: static: 3.04 Mb (96.41% used) dynamic: 1.25 Mb (64.22% used)
STATUS: static: 132.02 Mb (2.22% used) dynamic: 0.50 Mb (67.02% used)
STATUS: static: 261.02 Mb (1.12% used) dynamic: 0.50 Mb (67.70% used)
STATUS: static: 390.03 Mb (0.75% used) dynamic: 0.50 Mb (64.51% used)
STATUS: static: 1447.25 Mb (0.20% used) dynamic: 0.50 Mb (61.55% used)

The specific questions I have:
- what would cause static memory to be allocated at such a prodigous rate,
and why would the dynamic memory go down?
- I can see why the first allocation would occur, as the static memory is
96% used;  but why would it allocate so MUCH, and continue to allocate?

Some general questions that may help me as well:
- What do static/dynamic memory mean to DGD, and how are they used?
- I've noticed 'threads' in the driver docs ... is there any thread-safe
practices that must be observed in LPC to make sure there are no
concurrency problems?

Relevant config parameters:
swap_size       = 32767;                /* # sectors in swap file */
cache_size      = 256;                  /* # sectors in swap cache */
sector_size     = 512;                  /* swap sector size */
swap_fragment   = 32;                   /* # of objects to swap out */
static_chunk    = 64512;                /* static memory chunk */
dynamic_chunk   = 261120;               /* dynamic memory chunk */

Thanks in advance for any help!!
-T




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



More information about the DGD mailing list