Subject: RE: [jade-develop] Memory Leak in CyclicBehaviour/Receiver Behaviour JADE2.5??
From: Bellifemine Fabio (Fabio.Bellifemine@TILAB.COM)
Date: Wed Jul 31 2002 - 18:54:14 MET DST
James, there are a number of optimization and not completely correct
things you are doing:
- the method getInternalPollingTemplate() creates a number of new java
objects everytime is called but, on the other hand, they never change.
Better move it into the constructor of the behaviour.
- everytime the method action is called you create a new
ReceiverBehaviour. Probably in your case a better pattern is the
following:
public void action() {
ACLMessage msg = receive();
if (msg == null) {
block(); // block until a new message arrives
return;
} else {
// here put all your code that matches the message against a number
of templates.
}
-----Original Message-----
From: James Aldridge [mailto:james.aldridge@fdlearning.com]
Sent: 31 July 2002 17:31
To: jade-develop@sharon.cselt.it
Subject: [jade-develop] Memory Leak in CyclicBehaviour/Receiver
Behaviour JADE2.5??
(Apologies if posted more than once - email problems)
Our system is based on a number of agents each with a CyclicBehaviour
that
polls for incoming ACL messages. These Cyclic Behaviours (initiated at
agent startup) use a ReceiverBehaviour and MessageTemplates to determine
the
incoming message, and call another behaviour(s) based on the template.
I have been testing the system recently, and noticed that as the system
is
idling (i.e. no inter-agent messages are being sent, the agents are just
cycling / polling for incoming messages) the memory usage on the machine
is
gradually rising.
This is of concern to me because, as far as I can see from my code,
there is
no obvious point at which memory leaks may be occuring.
Has anyone else experienced memory leaks using the JADE platform, and in
particular CyclicBehaviour / ReceiverBehaviour?
I have attached a code snippet from one of my agents showing the Cyclic
behaviour (note that this is an inner class of an agent called
KPPMonitor).
I am using JADE 2.5, JRE 1.3.1 on Windows NT. Am I doing something
stupid
somewhere?
Please note that processor usage is not affected (this remains pretty
low
and constant during the cycling).
Any help or guidance would be very much appreciated.
Regards,
James.
James Aldridge
Developer - European Projects
Knowledge On Demand (KOD)
FD Learning Ltd.
james.aldridge@fdlearning.com
The information transmitted in this electronic mail message may contain
confidential and or privileged materials. For full details and
restrictions
see http://disclaimer.fdlearning.com
This archive was generated by hypermail 2a22 : Wed Jul 31 2002 - 18:54:24 MET DST