I read with interest how Drools 5 Fusion is able to compute when facts
can not longer activate anything, and garbage collects them. Very
clever and elegant! I am contemplating long-lived stateful working
memories in a Drools 4 application.
I assume that if I modify a fact, a new copy replaces the old copy,
and the old copy should be subject to Java garbage collection. No net
memory leak.
If I add a new fact, use it, am now done with it, neither Drools nor
Java knows it is collectible. If I have a rule like "When A and B...", I
may know the B event is completely dead, but Drools can't know if a new
A will arrive and use the B event in the activation.
What is the state of the practice for managing working memory for Drools
Expert applications?
* Do people write rules to manually delete facts when they are no longer
needed?
* Is Drools smarter than I know, and is able to do the garbage
collection of facts for itself?
* I gather one common option is to limit the lifetime of the session, to
do the nuclear garbage collection by killing the session and starting a
new one. That could be a lot of hassle here, there are no good stopping
points. I'd have to figure out what events need to be transferred over
into the new session.
Various people obviously run very large Drools apps but I have not seen
much discussion of this issue. I am hoping there is something obvious I
am missing, so I don't have to write an application-level fact collector
myself.
thanks, Allan