Re: Eclipse gets slower and slower...

From: Joachim Schimpf <j.schimpf_at_icparc.ic.ac.uk>
Date: Thu 06 Jun 2002 07:39:57 PM GMT
Message-ID: <3CFFBA8D.8146EE03@icparc.ic.ac.uk>
Peter Baumgartner wrote:
> 
> In my attempts to hunt the bug, I found by chance the bad guy: it is a
> declaration
> 
>   :- mode ht_flag(++,?).
> 
> Of course, my program conforms to this declaration.
> When creeping through the program execution, I observed that ht_flag
> is attempted way too often (say, 50 times or so, while there are only
> 8 ht_flag facts asserted).
> 
> Without this declaration, everything works fine: constant run times for
> the same query, and constant memory requirement. Before, memory was
> slightly increasing from query to query.
> 
> Is this a bug in Eclipse?


I didn't want to believe it at first, but you are right :-(

The bug is that the mode declaration also affects the behaviour
of retract and retract_all:

[eclipse 12]: mode ht_flag(++,?).
Yes (0.00s cpu)

[eclipse 13]: assert(ht_flag(1,2)).
Yes (0.00s cpu)

[eclipse 14]: retract(ht_flag(X,Y)).   % Bug: fails because of mode
No (0.00s cpu)

[eclipse 15]: ht_flag(1,Y).            % was not retracted
Y = 2
Yes (0.00s cpu)

[eclipse 16]: retract(ht_flag(1,Y)).   % this works...
Y = 2
Yes (0.00s cpu)


As a workaround, you can obviously just remove the mode declaration.
Alternatively, if you only need retract_all/1, you can use
abolish/1 instead (and repeat the dynamic declaration).



> ... constant memory requirement. Before, memory was
> slightly increasing from query to query.

One more remark, unrelated to the bug: if you have a server loop
that is supposed to run forever, and asserts/compiles are involved,
then you should call trimcore/0 between queries. This will do some
delayed deallocation of code memory. But since you observe
constant memory, maybe you do that already...


-- 
 Joachim Schimpf              /             phone: +44 20 7594 8187
 IC-Parc, Imperial College   /            mailto:J.Schimpf@ic.ac.uk
 London SW7 2AZ, UK         /    http://www.icparc.ic.ac.uk/eclipse
Received on Thu Jun 06 20:39:57 2002

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:16 PM GMT GMT