[rules-users] Issue 2782 - Potential memory leak when rules are often reloaded

Konstantin Pentarakis pentarakis at gmail.com
Mon Nov 15 11:20:25 EST 2010


Hi Leonardo,

Thank you very much for your fast response!

I mentioned why I re-added the same rules within the issue-description.
It is something like a "simulation" of lots of rule changes.  We are
building an application where rules will be created programmatically.
Rules will often change.

For me - it should be the same, whether I replace a rule with a DRL
that is in fact different from the original one, or with the same DRL.
Espacially when I do NOT change the DRL, the memory consumed by the KB
should not increase! But in fact it does ... at least if the rules
have lots of conditions.
To give an example:
I loaded 500 rules and used 64 MB heapsize. After I had loaded all the
rules the first time, the heap consumption was 21 MB. Aber the second
load, the heap consumption was 23 MB. It increased about 2 MB on each
interation. The application crashed on the 27th iterattion due to
"OutOfMemory: heap size". Even a forced garbage collection during the
iterations could not help. That means: It seems that there is a small
memory leak.

You wrote:
> I think that a better approach is to cache your knowledge base and get a
> *new
> *stateless or stateful session, whenever you need to run your rules. There's
> no need to re add the same rules to an existing KB before a run.

This problem has nothing to do with rule sessions! Caching the
KnowledgeBase is exactly what we intend to do! And we want to keep
this KB in memory for a long period of time (maybe some weeks) and to
modify it continously. That is why I wanted to test, how Drools
behaves when rules often change. For this test case it is not relevant
how much rule sessions have been created, is it?

Kind regards
Pentarakis

2010/11/15, Leonardo Gomes <leonardo.f.gomes at gmail.com>:
> Hi Pentarakis,
>
> I had a quick look at your issue. I couldn't understand why you're re-adding
> the same rules to your KB.
>
> * Now, I redo this and add the same 100 rules again to the KnowledgeBase
>> (2nd run). And so on.*
>>
>
> I think that a better approach is to cache your knowledge base and get a
> *new
> *stateless or stateful session, whenever you need to run your rules. There's
> no need to re add the same rules to an existing KB before a run.
>
> Hope that helps.
>
> Leonardo.
>
> On Mon, Nov 15, 2010 at 1:38 PM, Pentarakis <pentarakis at gmail.com> wrote:
>
>>
>> Hi!
>>
>> I created a new issue some days ago. I'm new to the jboss community and
>> therefore not sure whether I did it correctly. It seems like no one has
>> found it yet.
>>
>> Could somebody have a look at it and could provide me feedback?
>>
>> http://jira.jboss.org/browse/JBRULES-2782
>> http://jira.jboss.org/browse/JBRULES-2782
>>
>> THANK YOU VERY MUCH IN ADVANCE !!!
>>
>>
>> Kind regards
>> Pentarakis
>> --
>> View this message in context:
>> http://drools-java-rules-engine.46999.n3.nabble.com/Issue-2782-Potential-memory-leak-when-rules-are-often-reloaded-tp1904160p1904160.html
>> 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
>>
>



More information about the rules-users mailing list