swarm-support
[Top][All Lists]
Advanced

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

ReaperQueue


From: Jayshree Sarma
Subject: ReaperQueue
Date: Mon, 19 Jul 1999 19:26:59 -0400 (EDT)

Hi,

I modified the Heatbugs application to add a reaperQueue.
I did a search on the support archives and thought I had figured
out how to add the reaperQueue for the Heatbugs.

This is what I did:

In modelSwarm, I defined

id reaperQueue;

and did (as per Glen's message 12/12/96)

-setReaperQueue (id) aListPointer;

so that the Heatbugs can access the reaperQueue.

The Heatbugs have an energy parameter which is checked to
see if less than zero. If so the bug puts itself on the
reaperQueue.

In ModelSwarm the following is executed:

[modelActions createActionTo: self message: M (reapBugs)];

where:
-reapBugs {
   id index, deadBug;
   if ([reaperQueue getCount] = 0)
   {
    // Remove bugs in the reaper list from the heatbugsList
    index = [reaperQueue begin: self]
    while ( (deadBug = [index next]))
    {
       [heatbugList remove: deadBug];
       [deadBug drop];
    }
     [reaperQueue removeAll];
   }
   return self;
}

This compiles fine and runs ok till 1 bug dies and gets on the reaperQueue,
then I get the following error message
Segmentation fault (core dumped)

Using gdb I set breakpoint at reapBugs and did a step and get the following 
trace:
 
 _i_HeatbugModelSwarm__reapBugs (self=0x8170b30, _cmd=0x80beda4) at 
HeatbugModelSwarm.m:36
 _i_Object_s__perform_ (self=0x8170b30, _cmd=0x400b0678, aSel=0x80beda4) at 
DefObject.m:512
 _i_ActionTo_0___performAction__ (self=0x81bd1e8, _cmd=0x400b3b50, 
anActivity=0x81c0138) at Action.m:212
_i_Activity_c___run_ (self=0x81c0138, _cmd=0x400b3b38) at XActivity.m:187
_i_GroupIndex_c__nextAction_ (self=0x81bf848, _cmd=0x400b3b48, 
status=0x81c0148) at ActionGroup.m:371
_i_ListIndex_mlinks__next (self=0x81bf848, _cmd=0x400b1030) at List_GEN.m:280
_i_GroupIndex_c__nextAction_ (self=0x81bf848, _cmd=0x400b3b48, 
status=0x81c0148) at ActionGroup.m:382
_i_Activity_c___run_ (self=0x81c0138, _cmd=0x400b3b38) at XActivity.m:172
_i_Object_s__dropAllocations_ (self=0x81c0138, _cmd=0x400b3b40, 
componentAlloc=1) at DefObject.m:261
_i_Object_s__drop (self=0x81c0138, _cmd=0x40188740) at DefObject.m:180
_i_Activity_c__mapAllocations_ (self=0x81c0138, _cmd=0x401886e0, 
mapalloc=0xbffff820) at XActivity.m:602
_obj_dropAlloc (mapalloc=0xbffff820, objectAllocation=1) at DefObject.m:131
_i_GroupIndex_c__dropAllocations_ (self=0x81bf848, _cmd=0x40188680, 
componentAlloc=1) at ActionGroup.m:392
_i_OrderedSet_c__remove_ (self=0x81be8d8, _cmd=0x400b1038, aMember=0x81c0138) 
at OrderedSet.m:57
_i_List_mlinks__createIndex_fromMember_ (self=0x81be8d8, _cmd=0x4015bee4, 
aZone=0x80e8348, anObject=0x81c0138) at List_GEN.m:239
_c_Object_s__self (self=0x4015a18c, _cmd=0x4015a350) at DefObject.m:477
_i_ComponentZone_c__allocIVars_ (self=0x80e8348, _cmd=0x4015a358, 
aClass=0x4015a18c) at Zone.m:466
_i_Zone_c__allocIVarsComponent_ (self=0x80e8310, _cmd=0x4018a544, 
aClass=0x4015a18c) at Zone.m:215
xmalloc (size=20) at xmalloc.c:13
__libc_malloc (bytes=20) at malloc.c:2549
__libc_internal_tsd_get (key=_LIBC_TSD_KEY_MALLOC) at specific.c:171
specific.c:171: No such file or directory.
__pthread_mutex_trylock (mutex=0x404a2830) at mutex.c:54
__libc_malloc (bytes=20) at malloc.c:2559
chunk_alloc (ar_ptr=0x404a2420, nb=24) at malloc.c:2598
malloc.c:2598: No such file or directory.
Program received signal SIGSEGV, Segmentation fault.
0x80a6456 in objc_msg_lookup ()

And the trace stops at the following line in src/misc/xmalloc.c
       #ifndef USE_GC
 -->      ptr = malloc (size);
       #else

I ran the code on linux (redhat5.2, egcs-1.0.3) and SGI (egcs-1.1.1)
and on both machines I get a Segmentation fault (core dumped).

I not sure that the gdb trace is correct. I think the way I coded
the reaperQueue maybe wrong.  But any suggestions/help is appreciated.

Thanks,

Jayshree


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