<br>   Hmm, let me complement Wolfgang&#39;s comment: <br><br>&gt; After you have taken the compiled packages from the KB and
checked for errors, the KB has done his duty the KB ****MUST**** go :-)<br><br>   The above emphasis is mine. KnowledgeBuilder is a higher level object designed to encapsulate the parsing+compilation steps of resources. It is **not** designed to be reused and doing so might create inconsistencies. The memory spike you see when using the kbuilder is due to the java compiler... Drools itself does not do anything fancy in there other than generate some code (quite inexpensive memory wise) and compile it using either JDT or JANINO (both quite expensive memory wise, when compared to the other steps). <br>
<br>   So, I strongly discourage you keeping the KB around and as mentioned by Wolfgang, doing so might keep unnecessary objects in memory. <br><br>   Also, just to clarify, deserializing a compiled package means the compiler will not be called (obviously, as everything is already compiled) and that is why it should save you memory.<br>
<br>   Edson<br><br><div class="gmail_quote">2010/4/1 Wolfgang Laun <span dir="ltr">&lt;<a href="mailto:wolfgang.laun@gmail.com">wolfgang.laun@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
2010/4/1 miguel machado &lt;<a href="mailto:mls.machado@gmail.com">mls.machado@gmail.com</a>&gt;:<br>
<div class="im">&gt;<br>
&gt; 2010/3/31 Edson Tirelli &lt;<a href="mailto:ed.tirelli@gmail.com">ed.tirelli@gmail.com</a>&gt;<br>
&gt;&gt;<br>
</div><div class="im">&gt;&gt; 1. Do you use one KnowledgeBuilder to compile all your rule files or do<br>
&gt;&gt; you use one KnowledgeBuilder per file?<br>
&gt;<br>
&gt; Just one, declared as a static variable.<br>
<br>
</div>That wastes, whatever the KB takes, for the remaining duration of the program<br>
execution. After you have taken the compiled packages from the KB and<br>
checked for errors, the KB has done his duty the KB can go :-)<br>
<div class="im"><br>
<br>
&gt;&gt;<br>
&gt;&gt; 5. Did you tried compiling it once, generating the kbase and serializing<br>
&gt;&gt; it to a file, and then, instead of recompiling everything, just deserialize<br>
&gt;&gt; the file into memory and using it? How much memory it consumes when you<br>
&gt;&gt; deserialize from a file?<br>
&gt;<br>
&gt; Not sure what you mean there, is it<br>
&gt; this: <a href="http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html#d0e1070" target="_blank">http://downloads.jboss.com/drools/docs/5.0.1.26597.FINAL/drools-expert/html_single/index.html#d0e1070</a> ?<br>

&gt; if so, yes, i&#39;ve tried it and noticed no difference at all, was i supposed<br>
&gt; to?<br>
<br>
</div>For the application that just does the load part (reading the KPs from<br>
an input stream), yes: that<br>
should reduce memory usage.<br>
<br>
It certainly does not, if your KB is static, and you compile and load<br>
in the same program,<br>
just serializing and deserializing in between.<br>
<font color="#888888"><br>
-W<br>
</font><div><div></div><div class="h5"><br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>