Hi David,

This is a good question. The answer is that the instance count won't
grow without bounds, but it can get pretty darn high; I suppose the
limit in Jess 4.3 is

2 x 101 x (number of rules) x (number of LHS patterns per rule)

which for a "serious" ES, with let's say 300 rules, avg. 5
patterns per rule, is about 300,000 (yowza!) Most systems won't run
long enough, or generate enough partial matches, to come anywhere near
this number. Sharing in the Rete network will often make the real
upper limit smaller than this.

In any case, rest assured that there is an upper bound. Perhaps you
can calculate where this sits for your system, and maybe 47,000 is
already in the ballpark.

This number is intricately tied up with the central issue of
efficiency in Rete: partial-match storage and lookup. The '2' above is
the number of 'memories' that a Rete join node has; the '101' is the
maximum number of nodes in a binary tree in which partial matches are
stored (in Jess 3, there was no maximum number; the trees could indeed
grow without bounds.) 

It turns out that if you have many rules with lots of partial matches,
this number is optimal in terms of speed; the 'branchier' the tree,
the quicker the lookup if there are many entries per node. But if your
rules tend not to generate so many matches, then you get better
performance if the number is lower. Similarly, in a system where space
is at a premium, you might want to sacrifice speed for space. In the
next release of Jess 5.0 (in my current working copy, anyway) you'll
coincidentally have the ability to tune this value. Actually, you'll
be able to tune it on a global and on a per-rule basis, so that rules
that need the space will get it, while those that won't
don't. I've found that the 'monkey' problem can be sped up by about
20% by using a smaller number (actually, the value '1' is good, at
which point the trees degenerate to lists.)

I think David Young wrote:
> 
> Greetings. We've discovered what might be an indication that Jess 4.3
> is suffering from the "unintentional object retention syndrome",
> i.e. a memory leak. Some clarification would be appreciated.
> 
> Profiling our application with OptimizeIt (Intuitive Systems), we've
> noticed that instance counts of class 'jess.TokenTree' increase
> "without bounds"; allow other instance counts remain normal for our
> system. As an example, during a recent one-hour run, the instance
> count for 'jess.TokenTree' exceeded 47K, during which time the
> inference engine was running much of the time. In comparison, counts
> for class String, which are created with abandon, consistently hovered
> around 7K (I don't know if this comparison means anything; I just
> threw it in there). Other Jess classes seem to maintain reasonable
> instance counts.
> 
> As background, we're using Jess for an embedded expert system within a
> long-running simulation program, with the JavaSoft reference VM
> (1.1.6) on Solaris 2.6. I appreciate your comments.
> 
> Regards,
> 
> -- 
> 
> -------------------------------------------------------------
> David E. Young
> Fujitsu Network Communications  "The fact that ... we still
> ([EMAIL PROTECTED])    live well cannot ease the pain of
>                                  feeling that we no longer live nobly."
>                                   -- John Updike
> "Programming should be fun,
>  programs should be beautiful"
>   -- P. Graham
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to