2

I'm using jBoss Rules.But I run in to memory issues after using JBoss rules. Using a profiling tool I collected heap dump and I got the result as :

    One instance of "org.drools.reteoo.ReteooStatefulSession" loaded by 
    "sun.misc.Launcher$AppClassLoader @ 0x7f899fdb6d88" occupies 657,328,888 (78.91%) bytes. 
    The memory is accumulated in one instance of "org.drools.reteoo.ReteooStatefulSession" 
    loaded by "sun.misc.Launcher$AppClassLoader @ 0x7f899fdb6d88". 

    Keywords 
    sun.misc.Launcher$AppClassLoader @ 0x7f899fdb6d88 
    org.drools.reteoo.ReteooStatefulSession

The code I used for JBoss rules is given below.

            kbase= KnowledgeBaseFactory.newKnowledgeBase(); 
            ksession= kbase.newStatefulKnowledgeSession(); 
            final String str = CISMSRemotingUtils.getFullConfigFilePath("change-set.xml") ; 
            final String filePath = str.replaceAll(" ", "%20"); 
            aconf = KnowledgeAgentFactory .newKnowledgeAgentConfiguration(); 
            aconf.setProperty("drools.agent.newInstance", "false"); 
            kagent = KnowledgeAgentFactory.newKnowledgeAgent( "Agent", aconf); 
            kagent.applyChangeSet( ResourceFactory.newFileResource(filePath) ); 
            kbase = kagent.getKnowledgeBase(); 
            ksession= kbase.newStatefulKnowledgeSession(); 
            sconf =ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration(); 
            sconf.setProperty( "drools.resource.scanner.interval", "3600"); 
            ResourceFactory.getResourceChangeScannerService().configure( sconf ); 
            ResourceFactory.getResourceChangeNotifierService().start(); 
            ResourceFactory.getResourceChangeScannerService().start(); 

This piece of code is given in the class constructor and rules are fired inside this class

            ksession.insert(data); 
            ksession.fireAllRules(); 

I'm using drools 5.4.0

Can anyone help me to identify the problem?

Annie
  • 45
  • 2
  • 8
  • Are you sure there is any problem? JBoss Rules sessions may consume quite a large amount of memory, according to your knowledge base. Just make sure your JVM is started with enough maximum heap space so that it does not hit the memory limit (-Xmx option). – Guillaume G. Apr 03 '14 at 07:19
  • Without showing the rules code, it's not possible to identify whether there are optimisations which would reduce the memory usage in a useful way. – Steve Apr 07 '15 at 08:25

0 Answers0