swarm-support
[Top][All Lists]
Advanced

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

class-y bugs


From: Sven Thommesen
Subject: class-y bugs
Date: Thu, 25 Sep 1997 10:44:15 -0500

Well, it was a stray pointer all right, but not a string this time ;-)

So, for the newly initiated swarmers, here's a fresh example of what NOT to
do:

1) agent A creates a message object M and passes (a pointer to) it to agent B
2) agent A decides agent C also needs the info and passes (the pointer to)
M to C
3) agent B uses the info passed in, then tells M to 'drop'
4) agent C tries to access M through the passed-in pointer, and
....COREDUMP!!!

What made debugging interesting was that inbetween steps (3) and (4),
numerous objects had been dropped and others created, so that C's pointer
to M would occasionally point to a valid object, though rarely of M's class!

Solution: what agent A needed to do was to make a copy (clone) of M before
passing it to C. (In a language with automatic garbage collection the
solution might be different, but GNU objC isn't one of those.)

--> I invite other experienced swarmers [those whose egos wouldn't get in
the way, at least] to share their occasional bugswatting experiences with
the list! Learning from other people's mistakes is the best learning of
all, and it sure beats reading a dry book ...

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]