swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Plugging leaks...


From: mcmullin
Subject: Plugging leaks...
Date: Fri, 4 Apr 1997 16:03:02 -0700 (MST)


It seems that the memory leaks in the Swarm libraries
have been much reduced, if not quite completely
eliminated (thanks Roger!).  I had cause to look at
this because an app I'm working on turned out to have a
*major* leak, and I needed to know whether it was the
app or swarm that was at fault; so Glen <gepr> had a
fresh look at heatbugs, and yes, the rate of memory
leakage is *much* less than it used to be, and close to
negligable (it looked to me like it was no more than
tens of bytes per time step - maybe less...)

For what it's worth, in order to track down the much
bigger leak that I now knew was in my app, I wanted a
convenient way of monitoring memory usage (short of
running top in another window, which is a bit messy).
I wound up putting an instance variable in my
"WorldManager", called:

int sbrkKByte

I then included that in my probeMap, and added the
following somewhere which would get executed
"regularly":

  sbrkKByte = (int) (sbrk(0)) / 1024;

which give me a decimal display of the sbrk value (in
kByte units).  I needed to import <unistd.h> on my
Solaris box to get the prototype for sbrk().  You may
need something else on other systems.  I can't vouch
for exactly how this sbrk value relates to overall
memory usage of the app - but I think you should be
able to trust *increments* in it as indicating real
increments in memory usage.  Certainly this gave me an
easy way of seeing the memory leaking as I ran the app;
hierarchically commenting stuff out and re-testing then
(eventually) led me to the culprit.

Of course, there's probably some better indicator(s) of
memory allocation available, buried somewhere in Zone -
got any suggestions for us Roger?


Cheers,

Barry.


-- 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Barry McMullin, ALife Group,               |    address@hidden |
| Santa Fe Institute, 1399 Hyde Park Road,   |  Voice: +1-505-984-8800 |
| Santa Fe, NM 87501, USA.                   |  FAX:   +1-505-982-0565 |
| http://www.eeng.dcu.ie/~mcmullin           |                         |
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]