[rules-users] java.lang.OutOfMemoryError: Java heap space

Edson Tirelli tirelli at post.com
Mon Nov 12 13:35:56 EST 2007


   Thanks for reporting and providing workaround. I will look into fixing
that.

2007/11/12, vdelbart <delbart.v at mipih.fr>:
>
>
> Hello,
>
> I add this 4 lines in my code before the session.dispose() and the problem
> disapear :
>
>         session.removeEventListener((WorkingMemoryEventListener)logger);
>         session.removeEventListener((AgendaEventListener)logger);
>         session.removeEventListener((RuleFlowEventListener)logger);
>         session.removeEventListener((RuleBaseEventListener)logger);
>
> regards,
>
> V.
>
>
>
> vdelbart wrote:
> >
> > Good morning,
> >
> > I found a workaround : don't use the WorkingMemoryFileLogger !
> >
> > I create an issue : http://jira.jboss.com/jira/browse/JBRULES-1325
> >
> > regards,
> >
> > V.
> >
> >
> > vdelbart wrote:
> >>
> >> Hello,
> >>
> >> In my tests of the 4.0.3, I have some :  java.lang.OutOfMemoryError.
> >>
> >> So, I try a simple test with 10.000 sequential execution of 1 rule with
> >> no context and just a workingmemorylogger and I have the error :
> >> java.lang.OutOfMemoryError: Java heap space
> >>
> >> My code is :
> >>
> >> public class ExecReglesMemotyTest
> >> {
> >>
> >>      private static final Reader DRL = new
> >> InputStreamReader(ExecReglesMemotyTest.class
> >>                      .getResourceAsStream("/rules/exemple.drl"));
> >>
> >>      private static final String FICHIER_LOG = "session";
> >>
> >>      /**
> >>       * @param args
> >>       */
> >>      public static void main(String[] args)
> >>      {
> >>              try
> >>              {
> >>                      PackageBuilder builder = new PackageBuilder();
> >>                      builder.addPackageFromDrl(DRL);
> >>                      RuleBase ruleBase = RuleBaseFactory.newRuleBase();
> >>                      ruleBase.addPackage(builder.getPackage());
> >>                      for (int i = 0; i < 10000; i++)
> >>                      {
> >>                              StatefulSession session =
> ruleBase.newStatefulSession();
> >>                              WorkingMemoryFileLogger logger = new
> >> WorkingMemoryFileLogger(session);
> >>                              logger.setFileName(FICHIER_LOG);
> >>                              session.fireAllRules();
> >>                              logger.writeToDisk();
> >>                              session.dispose();
> >>                      }
> >>
> >>              }
> >>              catch (Exception e)
> >>              {
> >>                      // TODO Auto-generated catch block
> >>                      e.printStackTrace();
> >>              }
> >>      }
> >> }
> >>
> >> with this rule (doesn't matter):
> >> #created on: Fri Nov 09 15:48:45 CET 2007
> >> package initPackage
> >>
> >> #list any import classes here.
> >>
> >> rule "ERG9"
> >> when
> >>
> >> then
> >>
> >> end
> >>
> >> I try this in 4.0.1, and it's working (no OutOfMemoryError)
> >>
> >> What's the problem ?
> >>
> >> thanks for any information,
> >>
> >> V.
> >>
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/java.lang.OutOfMemoryError%3A-Java-heap-space-tf4779030.html#a13702134
> Sent from the drools - user mailing list archive at Nabble.com.
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  Software Engineer - JBoss Rules Core Developer
  Office: +55 11 3529-6000
  Mobile: +55 11 9287-5646
  JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071112/1f1c3a71/attachment.html 


More information about the rules-users mailing list