<font size="2"><font face="verdana,sans-serif">hi again,</font></font><div><font class="Apple-style-span" face="verdana, sans-serif"><br></font></div><div><div class="gmail_quote">2010/4/1 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:ed.tirelli@gmail.com">ed.tirelli@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><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></blockquote><div><br></div><div>I agree! But i don&#39;t exactly know how to do so... i mean, i call this method which creates the KB from a DRL file and then the kbase and returns the ksession, the KB object declaration scope is just that exact method, and once it reaches 300MB+ in memory, it just stays there... the KB object is no longer in use (or is it?) but memory keeps high. </div>
<div><br></div><div>I&#39;ve tried setting KB to &quot;null&quot; and then invoking the jvm garbage collector, but to no avail. I wish there was a simple way i could just destroy a particular object sigh</div><div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><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... </blockquote>
<div><br></div><div>I understand that, and i&#39;ll have that if i must, but the thing is it&#39;s not just a spike, it is prolonged throughout execution, it doesn&#39;t reduce afterwards.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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></blockquote><div><br></div><div>Like i said earlier, it&#39;s not that i want to keep KB around, i just can&#39;t remove it.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><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>
</blockquote><div><br></div><div>Thanks for clarifying that! I&#39;ve tested with a separate application to build a compiled file and then load it in the main system and it really makes a difference! it&#39;s gone to &lt;100MB wow! However, this was just a proof-of-concept, as i&#39;m not sure how i could apply the same technique to the main standalone application. Do i really have to create a separate process/application just for building/compiling the rules, to make sure the compilation-object-junk doesn&#39;t stay in memory along with the rest?</div>
<div><br></div><div>Thanks for all the feedback and input so far.</div><div>_ miguel</div><div><br></div></div><br>-- <br>&quot;To understand what is recursion you must first understand recursion&quot;<br>
</div>