swarm-support
[Top][All Lists]
Advanced

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

Re: Clarification on the effect of "DROP" on subobjects.


From: Paul E Johnson
Subject: Re: Clarification on the effect of "DROP" on subobjects.
Date: Tue, 31 Oct 2000 10:48:24 -0600

Steve Jackson wrote:
> 
>     If create a char* or int* etc, the drop message to your zone will not
> deallocate
>     the memory, you still must do that.

Don't use malloc or xmalloc to get the memory. Use Swarm's alloc or
allocBlock to get the memory, and then the allocation will be in the
zone and it will get dumped automagically, along with everything else.

In my current frame of mind, here is how I imagine using this.

In ModelSwarm, there is a loop creating agents:

for(i=0; i< N; i++)
{
        id objZone = [Zone create: [self getZone]];
        id aCitizen = [Citizen createBegin: objZone];
}

Inside the Citizen class, memory is allocated only with Swarm Zone aware
methods, no malloc.  

Now, to get rid of these beasties.  [aCitizen drop] does not seem to
quite do it. Does the ModelSwarm have to:


        aZone = [aCitizen getZone];
        [aZone drop];
        [aCitizen drop];
?

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

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