for help you to understand the problem, I have make a small TestCase.
This memory leak is not "infinity", the maximum size of this memory leak is
"~ size(WorkingMemory + Facts) x number rules on the rules base".
De : Galante, Yves
Objet : Potential multi thread error and "smal" memory leak
Class VariableContextEntry and ReturnValueContextEntry are
when Package.addRule called.
This class are linked from "Package rules".
"Package => ... => VariableContextEntry
But class have a reference to the InternalWorkingMemory !
"Package => ... => VariableContextEntry => Workingmemory"
When this pseudo code is executed, at the end of the execution,
WorkingMemory need to be garbage collected, but it isn't
because she is
referenced by ReturnValueContextEntry and/or
this class keeps an reference to the WorkingMemory.
I think this can be generate some error in multi thread and make an
"smal" memory leak.
It is right ?
The membre workingMemory can't be removed from
pseudo code (source : ReteooMannersTest) :
final Package ruleBase = new Package( "org.drools.examples.manners" );
ruleBase.addRule( getAssignFirstSeatRule() );
SatefulSession session = ruleBase.newStatefulSession(false);
session = null;
After GC, workingMemory (session) need to be finally but she isn't
because VariableContextEntry/ReturnValueContextEntry keep a
Thanks for your response