You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2008/10/07 09:42:53 UTC

[jira] Updated: (SM-1524) Fix for Memory Leak in ServiceMix-Drools4 DroolsEndpoint

     [ https://issues.apache.org/activemq/browse/SM-1524?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet updated SM-1524:
--------------------------------

    Fix Version/s: servicemix-drools-2008.01

> Fix for Memory Leak in ServiceMix-Drools4 DroolsEndpoint
> --------------------------------------------------------
>
>                 Key: SM-1524
>                 URL: https://issues.apache.org/activemq/browse/SM-1524
>             Project: ServiceMix
>          Issue Type: Bug
>          Components: servicemix-drools
>    Affects Versions: 3.2.1
>            Reporter: Roman Stumm
>            Assignee: Gert Vanthienen
>             Fix For: 3.3, servicemix-drools-2008.01
>
>
> There is a memory leak in class org.apache.servicemix.drools.DroolsEndpoint, because the StatefulSession object must be released, otherwise the drools rulebase keeps a reference to it. 
> (Description see drools docu: 
> http://downloads.jboss.com/drools/docs/4.0.7.19894.GA/html_single/index.html#d0e900
> Chapter 2.5.5
> The StatefulSession extends the WorkingMemory class. It simply adds async methods and a dispose() method. The ruleBase retains a reference to each StatefulSession is creates, so that it can update them when new rules are added, dispose() is needed to release the StatefulSession reference from the RuleBase, without it you can get memory leaks.
> )
> Here is the fix: (replace methods drools() and createWorkingMemory() with those in  org.apache.servicemix.drools.DroolsEndpoint)
>   protected void drools(MessageExchange exchange) throws Exception {
>         StatefulSession memory = createWorkingMemory(exchange);
>         try {
>             populateWorkingMemory(memory, exchange);
>             memory.fireAllRules();
>         } finally {
>             memory.dispose();
>         }
>     }
>     
>     protected StatefulSession createWorkingMemory(MessageExchange exchange) throws Exception {
>         return ruleBase.newStatefulSession();
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.