[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
createFAction, which Zone?
From: |
Lourens van der Meij |
Subject: |
createFAction, which Zone? |
Date: |
Thu, 28 Feb 2002 14:44:42 +0100 (CET) |
I just started out getting to know swarm;I am trying to give some
assistance to a swarm-user here (Fred Wan)
My first job was solving a memory leak, i.e. following
the "Memory exhausion" thread of december last year.
I managed to solve the memory problems. They were
programming errors (i.e. not dropping attached EmptyProbeMapImpl
by dying agent).The sugestion of using xprint proved very useful.
In a later version there was another memory leak, which I traced back
to usage of MapImpl. I noticed that the new Integer() java keys
and the java object values did not get garbage collected.
By more closely reading the FAQ I now think I understand
that if one would like to use Objective-C datastructures,
one should only use java objects that are sub-objects of
SwarmObject (more precise Drop interface?). Is this correct?
Anyhow, I advised the user to use the java HashMap instead.
Another point:
Marcus Daniels suggested using createFAction instead of
createActionTo$message and createFActionForEachHeterogeneous$call
instead of createActionForEach$message.
A number of points:
1)There was no effect on memory consumption but performance
increased dramatically (factor of 10 for GUI-less simple simulation).
2)I could not find out what the appropriate Zone was in some calls, i.e.
in an "ObserverSwarm" there was code:
displayActions.createActionTo$message
(Globals.env.probeDisplayManager,
new Selector(Globals.env.probeDisplayManager.getClass(),
"update", false));
which I tried to replace with
Zone z = ???
tried z = Globals.env.probeDisplayManager.getZone();
tried z= getZone();
tried z = Globals.env.globalZone;
Selector sel = new Selector(Globals.env.probeDisplayManager.
getClass(),
"update", false);
FArguments fa = new FArgumentsImpl(z, sel);
FCall fc = new FCallImpl(z, this, sel, fa);
displayActions.createFAction(fc);
I got exceptions, whatever Zone I tried.
The same problem with
displayActions.createActionTo$message(
getActionCache(),
new Selector (getActionCache().getClass(),
"doTkEvents", true));
What zone to use in the FCall version?
3)As there was such a performance increase I started wondering whether
other calls could be improved as well.
There are obvious candidates which I replaced,i.e. all classes having
FActionCreating interface. (used it in a ActionGroup and Schedule).
But I also noticed:
modelSchedule = new ScheduleImpl(getZone(), 1);
modelSchedule.at$createAction(0, modelActions);
There is an equivalent modelSchedule.at$createFAction(1, ??)
I suppose it is only useful if the Object anActionType
is a java method call, i.e. there is a Selector involved?
In the source that I am currently inspecting I only find
a candidate in
targetDisplay = new Object2dDisplayImpl
(getZone(), worldRaster, modelSwarm.getTargetSpace(),
new Selector(Class.forName("TargetBug"),"drawSelfOn", false));
but there seems to be no FCall access there.
Thanks for reading,
Lourens
==================================
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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- createFAction, which Zone?,
Lourens van der Meij <=