swarm-support
[Top][All Lists]
Advanced

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

Re: createBegin and multiple objects---segmentation fault


From: Ken Cline
Subject: Re: createBegin and multiple objects---segmentation fault
Date: Thu, 29 Jul 1999 14:48:16 -0400 (EDT)

On Thu, 29 Jul 1999, DARREN MATTHEW SCHREIBER wrote:

> 
> In one of the models I am working on, I have added a new census tract
> object that will look at some portion of the 2d grid and hold the
> statistics for that area.  I have set it up so that the initial values for
> the statistics is set during the createBegin part of the modelSwarm.  But,
> I am wondering whether this might be causing the segementation fault I am
> getting.
> 
> I create the residents of the grid in the same createBegin method and
> after they are created I have the tract objects query the residents in
> their area so that I can set intial parameters for the tracts. (My
> thinking is that I set the inital parameters for the tracts and then only
> update the data when something happens, to cut down processing time).
> 
> Since I haven't used createEnd yet, are the residents incomplete and thus
> unusable.  Do I have to use createEnd before I can deal with the objects?

It depends on the object and what you mean by "deal". In the
case of grids (Discrete2d subclasses), yes you should call
`createEnd' before using the grid because that is where the
internal lattice (ie array) is allocated.

I don't know enough about the "residents" objects to comment,
but if they're *simple* subclasses of SwarmObject, then in
most cases you can probably "deal" with them before `createEnd'
is called.

Technically speaking, if you are following the Swarm programming
style you should only send "Creating" phase and "Setting" phase
messages to an object before `createEnd' is called.


> As a more general issue, what is the best way of tracking down a
> segmentation fault?

I use gdb.  That is, after the seg fault and core dump, type 
the command `gdb <app> core' and when gdb finishes loading
the symbols, type `bt' at the gdb prompt.


_________________________________________________________
Ken Cline                             address@hidden
SAIC                                 VOICE (410) 571-0413
Annapolis, MD                          FAX (301) 261-8427




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