Hi all,
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".
Yves
<<MemoryLeakTest.zip>>
-----Message d'origine-----
De : Galante, Yves
Objet : Potential multi thread error and "smal" memory leak
Hi,
Class VariableContextEntry and ReturnValueContextEntry are
instantiated
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
VariableContextEntry, and
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
VariableContextEntry/ReturnValueContextEntry ?
____________________
pseudo code (source : ReteooMannersTest) :
final Package ruleBase = new Package( "org.drools.examples.manners" );
ruleBase.addRule( getAssignFirstSeatRule() );
...
SatefulSession session = ruleBase.newStatefulSession(false);
session.insert(new Count(1));
session.fireAllRules();
session.dispose();
session = null;
System.gc();
After GC, workingMemory (session) need to be finally but she isn't
because VariableContextEntry/ReturnValueContextEntry keep a
reference at
the workingMemory.
Thanks for your response
Yves