On Wed, Nov 26, 2008 at 1:10 PM, Edson Tirelli <span dir="ltr">&lt;<a href="mailto:tirelli@post.com">tirelli@post.com</a>&gt;</span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>&nbsp;&nbsp; Ok, lets start with a simple thing:<div class="Ih2E3d"><br><br>4128<a href="http://carrot.gaiam.com:7000/instances/0x2aaad6103ff0" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad6103ff0" target="_blank">class org.drools.rule.Pattern</a>
<br><br></div>&nbsp;&nbsp; I can&#39;t see how 16 rules can create that many patterns. Are you sure you are not recompiling/recreating your rulebase multiple times? If not, then we may have a serious problem...<br><br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson</blockquote>
<div><br><br>Thanks, Edson. I think that recompilation may be the problem; I&#39;m creating the RuleBase in a @PostConstruct method in an ejb3 stateless session bean, and it looks like if multiple instances of the session bean are added to the pool the rule base is compiled multiple times. So, how to get around this problem? In another thread you said:<br>
<br>&gt; Also, usage of statics is not always good, specially if you intent to run your application in a JEE environment.<br><br>so I presume that using a regular old singleton to share the RuleBase instance is not a good idea. Is there any approach you can suggest that will avoid using statics? This app is running under Glassfish.<br>
<br>Thanks for your help,<br><br>Kris<br><br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br><div class="gmail_quote">2008/11/26 Kris Nuttycombe <span dir="ltr">&lt;<a href="mailto:kris.nuttycombe@gmail.com" target="_blank">kris.nuttycombe@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">
Hi, all,<br><br>I&#39;m encountering significant problems with running out of memory when executing a small ruleset (only 16 rules, &lt; 100 facts). I&#39;ve run jmap on the process (which has previously spawned multiple stateless sessions in parallel) and it looks like Drools, and specifically the Eclipse jdt compiler, is seriously eating up memory. The code calling the is fairly simple; one of the initial facts is an accumulator that I refer to later:<br>


<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; StatelessSession session = ruleBase.newStatelessSession();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session.execute(initialFact, accumulator);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; accumulator.doSomething();<br><br>where ruleBase is a shared instance, and initialFact is a base fact that is expanded during rules processing. Is there something I should be doing to dispose the session after use to release the objects created by the drools compiler after use? I&#39;m using a shared RuleBase, and I&#39;m wondering whether it is somehow keeping references around. Are these sorts of object counts to be expected?<br>


<br>Thanks,<br><br>Kris<br><center><h1>
Instance Counts for All Classes (excluding platform)</h1></center>
104827<a href="http://carrot.gaiam.com:7000/instances/0x2aaacf5646f8" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaacf5646f8" target="_blank">class net.jxta.impl.document.LiteXMLElement$charRange</a>
<br>
26806<a href="http://carrot.gaiam.com:7000/instances/0x2aaacf5631e8" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaacf5631e8" target="_blank">class net.jxta.impl.document.LiteXMLElement$tagRange</a>
<br>
26733<a href="http://carrot.gaiam.com:7000/instances/0x2aaad66ea7f0" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad66ea7f0" target="_blank">class org.eclipse.jdt.internal.compiler.lookup.MethodBinding</a>
<br>
17366<a href="http://carrot.gaiam.com:7000/instances/0x2aaad66e3c88" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad66e3c88" target="_blank">class [Lorg.eclipse.jdt.internal.compiler.lookup.TypeBinding;</a>
<br>
12412<a href="http://carrot.gaiam.com:7000/instances/0x2aaacf032560" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaacf032560" target="_blank">class com.sun.enterprise.loader.EJBClassLoader$SentinelInputStream</a>
<br>
10974<a href="http://carrot.gaiam.com:7000/instances/0x2aaad5504450" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad5504450" target="_blank">class org.apache.commons.collections.SequencedHashMap$Entry</a>
<br>
8683<a href="http://carrot.gaiam.com:7000/instances/0x2aaad68c3840" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad68c3840" target="_blank">class org.eclipse.jdt.internal.compiler.codegen.CachedIndexEntry</a>
<br>
7708<a href="http://carrot.gaiam.com:7000/instances/0x2aaacf55e9d8" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaacf55e9d8" target="_blank">class net.jxta.impl.document.LiteXMLElement</a>
<br>
7450<a href="http://carrot.gaiam.com:7000/instances/0x2aaad5c4b6c0" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad5c4b6c0" target="_blank">class org.hibernate.engine.CollectionKey</a>
<br>
6836<a href="http://carrot.gaiam.com:7000/instances/0x2aaaced3c3f8" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaaced3c3f8" target="_blank">class org.netbeans.modules.schema2beans.AttrProp</a>
<br>
6271<a href="http://carrot.gaiam.com:7000/instances/0x2aaad6642d18" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad6642d18" target="_blank">class org.eclipse.jdt.internal.compiler.lookup.FieldBinding</a>
<br>
5643<a href="http://carrot.gaiam.com:7000/instances/0x2aaad6796890" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad6796890" target="_blank">class org.eclipse.jdt.internal.compiler.ast.MessageSend</a>
<br>
4928<a href="http://carrot.gaiam.com:7000/instances/0x2aaad68a6018" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad68a6018" target="_blank">class org.eclipse.jdt.internal.compiler.util.HashtableOfObject</a>
<br>
4895<a href="http://carrot.gaiam.com:7000/instances/0x2aaad66e3fa8" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad66e3fa8" target="_blank">class [Lorg.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;</a>
<br>
4546<a href="http://carrot.gaiam.com:7000/instances/0x2aaad669f968" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad669f968" target="_blank">class org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding</a>
<br>
4472<a href="http://carrot.gaiam.com:7000/instances/0x2aaad687a0a8" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad687a0a8" target="_blank">class [Lorg.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;</a>
<br>
4128<a href="http://carrot.gaiam.com:7000/instances/0x2aaad6103ff0" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad6103ff0" target="_blank">class org.drools.rule.Pattern</a>
<br>
3899<a href="http://carrot.gaiam.com:7000/instances/0x2aaacf493c90" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaacf493c90" target="_blank">class net.jxta.impl.id.UUID.UUID</a>
<br>
3867<a href="http://carrot.gaiam.com:7000/instances/0x2aaad5c416c0" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad5c416c0" target="_blank">class org.hibernate.engine.EntityEntry</a>
<br>
3731<a href="http://carrot.gaiam.com:7000/instances/0x2aaad5c54d88" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad5c54d88" target="_blank">class org.hibernate.collection.PersistentSet</a>
<br>
3685<a href="http://carrot.gaiam.com:7000/instances/0x2aaad66ca420" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad66ca420" target="_blank">class org.eclipse.jdt.internal.compiler.lookup.UnresolvedReferenceBinding</a>
<br>
3360<a href="http://carrot.gaiam.com:7000/instances/0x2aaad6c12770" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad6c12770" target="_blank">class org.drools.reteoo.SingleTupleSinkAdapter</a>
<br>
3266<a href="http://carrot.gaiam.com:7000/instances/0x2aaacf543dc0" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaacf543dc0" target="_blank">class net.jxta.document.MimeMediaType</a>
<br>
3264<a href="http://carrot.gaiam.com:7000/instances/0x2aaad6370288" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad6370288" target="_blank">class org.drools.spi.PatternExtractor</a>
<br>
3163<a href="http://carrot.gaiam.com:7000/instances/0x2aaad5f8b990" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad5f8b990" target="_blank">class org.apache.axis.encoding.TypeMappingImpl$Pair</a>
<br>
3137<a href="http://carrot.gaiam.com:7000/instances/0x2aaad5caad98" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad5caad98" target="_blank">class org.hibernate.collection.PersistentBag</a>
<br>
2881<a href="http://carrot.gaiam.com:7000/instances/0x2aaad681b000" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad681b000" target="_blank">class org.eclipse.jdt.internal.compiler.lookup.MethodScope</a>
<br>
2688<a href="http://carrot.gaiam.com:7000/instances/0x2aaad6161860" target="_blank"> instances</a> of <a href="http://carrot.gaiam.com:7000/class/0x2aaad6161860" target="_blank">class org.drools.base.ClassFieldExtractor</a>
<br>
<br></div></div><div class="Ih2E3d">_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></div></blockquote></div></blockquote></div><br>