swarm-support
[Top][All Lists]
Advanced

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

[Q] seg-fault in malloc?


From: Gary Polhill
Subject: [Q] seg-fault in malloc?
Date: Wed, 29 Sep 1999 13:51:07 +0100

Apologies, this isn't the right place to ask this question, but I'm running
a Swarm model and getting seg-faults during a call to malloc (from inside
a Swarm function). I've never seent this before -- anyone have any ideas?

Heres a bt:

Program received signal SIGSEGV, Segmentation fault.
0xef585998 in _smalloc ()
(gdb) bt
#0  0xef585998 in _smalloc ()
#1  0xef5859e0 in malloc ()
#2  0xcae18 in xmalloc (size=4) at xmalloc.c:13
#3  0xca90c in -[Zone(c) _allocBlock:] (self=0x4cd6d8, _cmd=0x34ae68, size=4)
    at Zone.m:28
#4  0xafc48 in initArray (self=0x4cc560) at Array.m:113
#5  0xafb28 in +[Array(c) _create:setCount:] (self=0x4cc560, _cmd=0x323b8c, 
    aZone=0x4cd6d8, memberCount=1) at Array.m:69
#6  0x458bc in +[BitString create:setBitCount:] (self=0x4cc538, _cmd=0x3270f4, 
    aZone=0x4cd6d8, aBitCount=20) at BitString.m:50
#7  0x54904 in -[LandUse getLUMatchWith:] (self=0x4c4a08, _cmd=0x32724c, 
    aBitString=0x4cc4e8) at LandUse.m:154
#8  0x550c8 in -[LandUse getMatchWithLandParcel:climate:economy:] (
    self=0x4c4a08, _cmd=0x4c4a08, aLandParcel=0x4c21d8, aClimate=0x492f10, 
    anEconomy=0x492f60) at LandUse.m:261
#9  0x537a8 in -[LandParcel calculateYield] (self=0x4c21d8, _cmd=0x324a10)
    at LandParcel.m:349
#10 0x499e0 in -[Environment calculateYield] (self=0x493770, _cmd=0x3279b4)
    at Environment.m:96
#11 0xbe380 in -[Object(s) _perform:] (self=0x493770, _cmd=0x33f0b0, 
    aSel=0x3279b4) at DefObject.m:511
#12 0x92854 in -[ActionTo(0) __performAction::] (self=0x4bbe68, _cmd=0x33d590, 
    anActivity=0x4bf638) at Action.m:211
#13 0x90c2c in -[Activity(c) __run:] (self=0x4bf638, _cmd=0x33d578)
    at XActivity.m:185
#14 0x90b00 in -[Activity(c) __run:] (self=0x4be2a8, _cmd=0x33d578)
    at XActivity.m:143
#15 0x90b00 in -[Activity(c) __run:] (self=0x4bd9b8, _cmd=0x33d578)
    at XActivity.m:143
#16 0x90b00 in -[Activity(c) __run:] (self=0x4be7a8, _cmd=0x33d578)
    at XActivity.m:143
#17 0x90b00 in -[Activity(c) __run:] (self=0x4bca48, _cmd=0x33d560)
    at XActivity.m:143
#18 0x909d8 in -[Activity(c) _run] (self=0x4bca48, _cmd=0x331848)
    at XActivity.m:72
#19 0x79ad8 in -[ControlPanel startInActivity:] (self=0x424700, _cmd=0x331858, 
    activityID=0x4bca48) at ControlPanel.m:79
#20 0x7a4c0 in -[GUISwarm go] (self=0x3fc518, _cmd=0x32fc24) at GUISwarm.m:47
#21 0x75130 in main (argc=4179224, argv=0x38b000) at main.m:76


Some general questions that might shed light on the matter:

I use xmalloc (provided by the Swarm libraries) to allocate memory in 
some of my objects. Is this frowned upon? What should I be using?

Is it OK to free a pointer allocated using xmalloc? (Is there some other
function than free that I should use to do this?)

Thanks in advance,

Gary

-- 

Macaulay Land Use Research Institute, Craigiebuckler, Aberdeen. AB15 8QH
Tel: +44 (0) 1224 318611               Email: address@hidden

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