swarm-support
[Top][All Lists]
Advanced

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

Re: Memory leak ? (Solved)


From: Christopher S Riolo
Subject: Re: Memory leak ? (Solved)
Date: Sun, 06 Sep 1998 13:52:47 -0400

At 03:26 PM 9/4/1998 -0500, I wrote:
>
>I just had reason to subject my newly-converted-to-1.3 app to some really
>long runs, and discovered that it keeps growing until it runs out of room.
>
>I *assume* the problem is my own programming, but I just thought before I
>devote the weekend to chasing elusive bugs ...

Well, I'm happy to report that of course the problem was mine, and it was
of the
one-object-creates-a-List-and-passes-it-to-another-object-which-neglects-to-
properly-drop-it variety. My app now runs forever at the same, slim size!

Happily I did not have to resort to the external malloc-replacement
libraries recommended by Marcus; the Swarm Zone management proved to do the
trick nicely. 

The technique I used to find it might be useful to others: 

I created a number of memory zones under globalZone, and assigned objects
to specific zones as they were being created. Then I scheduled a snapshot
of the number and size of the objects in each zone for each time period. 

I only have two categories of objects: (a) those that live for the duration
of the sim, whose number and size should stay constant,  and (b) those that
are created and destroyed in the course of a single time step, whose number
and size should be ZERO at the start and end of each time step.  (No
birth/death among the population yet.) 

So when a zone showed a steadily increasing size over time, I knew where
the problem was and could narrow it down -- leaving the still-suspect
objects in the 'twilightZone', of course ;-)

Tools for the task:

Zone provides a method, -getPopulation, which provides a pointer to the
Zone's list of objects. Cycling through this list to tally the the number
and total allocation of the objects turned out to be gruesomely slow, so I
added code to Zone to maintain internal statistics and provide them in the
form of -getPopulationCount and -getPopulationTotal methods. I'm hoping
Marcus will add those to the next release of Swarm.

Cheers -- and now back to watching McGwire and Sosa make history!

--Sven



                  ==================================
   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.
                  ==================================


                  ==================================
   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]