The important issue is not whether the memory usage grows, but whether
it grows forever or levels off. It is normal for it to grow and not
shrink; it would not be normal for it to grow forever, however. Which
are you observing?
The Rete network contains many "memories," and each one grows in
capacity as required. In the current implementation, they never
shrink, only grow. Growing (which comes down to allocating bigger
arrays and copying elements) is costly, and shrinking would be an
additional expense.
After a system has run for a while, all the memories get to their peak
sizes, and RAM usage levels off. A lot of RAM will then be consumed by
empty but reserved space making up the memories, and this is probably
what you're observing. You can adjust this total memory usage by
playing with the global node-index-hash value, which will reduce the
total number of submemories, possibly impacting performance,
Alternatively, the existing memories could be made to shrink
sometimes. You could do this in TokenVector.removeElementAt(), by
doing something like
final void removeElementAt(int i)
{
m_v[i] = m_v[m_ptr-1];
m_v[--m_ptr] = null;
if (m_ptr > 10 && (m_v.length - m_ptr) > m_ptr) {
Token[] tmp = new Token[m_ptr + 5];
System.arraycopy(m_v, 0, tmp, 0, m_ptr);
m_v = tmp;
}
}
But you'd have to think about it and make some careful measurements to
avoid thrashing (grow, shrink, grow, shrink...)
I think Dheeraj Kakar wrote:
> Hello,
>
> Thanks for your reply.
> The test was done after applying the fixes to TokenVector.
>
> Thanks
>
>
>
> [EMAIL PROTECTED] wrote:
>
> > This is probably a bug described previously on this list:
> >
> > http://www.mail-archive.com/[email protected]/msg04114.html
> >
> > The patch was included in version 6.1a2, or you can apply it yourself
> > to 6.0.
> >
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
Org. 8920, MS 9012 [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
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------