[rules-dev] RE: Potential multi thread error and "smal" memory leak

Galante, Yves Yves.Galante at generali.ch
Tue Jan 29 03:47:22 EST 2008


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
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-dev/attachments/20080129/b9ae0d54/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MemoryLeakTest.zip
Type: application/x-zip-compressed
Size: 1974 bytes
Desc: MemoryLeakTest.zip
Url : http://lists.jboss.org/pipermail/rules-dev/attachments/20080129/b9ae0d54/attachment.bin 


More information about the rules-dev mailing list