Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Jamie
Thanks, Mark.  That's what I figured.  Not sure why it worked for Alejandro,
but I won't pursue that avenue anymore.  As I mentioned earlier, I did try
to upgrade to 5.3.0.CR1, but there's a new bug in that version that makes it
unusable for me.  (You've been involved in that thread as well).  I'm
planning to open a Jira ticket for the bug this afternoon.  Hopefully the
next CR for 5.3.0 fixes that bug.

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397595.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Mark Proctor
On 05/10/2011 19:11, Jamie wrote:
> Thanks for the reply, Alejandro.
>
> I'm currently using these jars:
>
>   knowledge-api-5.2.0.Final.jar
>   drools-core-5.2.0.Final.jar
>   drools-compiler-5.2.0.Final.jar
>   jbpm-flow-5.1.0.Final.jar
>   jbpm-flow-builder-5.1.0.Final.jar
>   jbpm-bpmn2-5.1.0.Final.jar
you need to be using drools 5.3.CR1 with jbpm 5.1.1.final

Mark
>
> I tried changing the three jbpm jars to 5.1.1 and I got a
> NoClassDefFoundError on org.drools.time.impl.TimerJobFactoryManager.  I only
> see that class in drools-core-5.3.0.CR1.jar, so I think this is a dead-end
> for me unless I'm missing something.
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397401.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Jamie
Thanks for the reply, Alejandro.  

I'm currently using these jars:

 knowledge-api-5.2.0.Final.jar 
 drools-core-5.2.0.Final.jar 
 drools-compiler-5.2.0.Final.jar 
 jbpm-flow-5.1.0.Final.jar 
 jbpm-flow-builder-5.1.0.Final.jar 
 jbpm-bpmn2-5.1.0.Final.jar 

I tried changing the three jbpm jars to 5.1.1 and I got a
NoClassDefFoundError on org.drools.time.impl.TimerJobFactoryManager.  I only
see that class in drools-core-5.3.0.CR1.jar, so I think this is a dead-end
for me unless I'm missing something.


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397401.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread alopez
Yes, I got the same exception, you can't remove all listeners from the
outside (at least in 5.2.0.Final), that's why I patched the
AbstractWorkingMemory class to hardcode the listeners removal inside Drools.

But now that I found JBPM 5.1.1.Final that seems to solve the problem in a
better way, the memory leak doesn't appear in my tests using that version of
jbpm in combination with Drools.

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397279.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Jamie
I'm trying to remove the listeners myself as Edson suggests, but I can't
figure out how to make it work.  I added this to my code just to see how
many listeners there were (I expected to see three - one for each of my
flows - based on what I see in the heap dump):

Collection listeners = session.getAgendaEventListeners();
LOGGER.debug("Agenda event listeners: " + listeners.size());

I was planning to then iterate over the collection and call
session.removeEventListener(),

However, when I run it, get this exception:

java.lang.ClassCastException: org.jbpm.process.instance.ProcessRuntimeImpl$3
incompatible with org.drools.event.rule.AgendaEventListener
at
org.drools.impl.StatefulKnowledgeSessionImpl.getAgendaEventListeners(StatefulKnowledgeSessionImpl.java:182)

Any ideas?


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3397001.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread alopez
Hi Marc, Mario,

I'm using the same test case on this thread, and oing more tests I now
realized what is the problem, this leak appears only if the pom file has the
dependency to jbpm-bpmn2 5.1.0.Final along with Drools 5.2.x or 5.3.x.

Re-reading Jamie's post earlier I was puzzled by his reference to jbpm-bpmn2
5.1.1.Final, because is not listed as a version on
http://www.jboss.org/jbpm, but looking at the public maven repo I saw it
really exists, using that version of JBPM resolved the problem, even for
5.2.0.Final.

So in summary Drools 5.2.x and forward do not work properly with JBPM
5.1.0.Final, it would probably be helpful to add some reference to this in
the release notes. And also maybe provide a link to JBPM 5.1.1.Final that I
only saw in the maven repo, no documentation or download link is available
in JBPM site.

Thanks for your help

Alejandro


--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3396355.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Mario Fusco
Hi Alejandro,

I checked if I could reproduce the memory leak in 5.3 by using the test case
posted in the first email of this thread, but I wasn't able to do that. In
other words it seems to me that all listeners are removed as expected in the
dispose method. 

Were you using a different use case that shows the problem? If so could you
share it?

Thanks a lot,
Mario

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3396143.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-05 Thread Mark Proctor
On 04/10/2011 22:51, alopez wrote:
> Good news, I followed your advice and patched drools-core to prevent this,
> focusing on removing all listeners:
>
> AbstractWorkingMemory.java, line 1246:
>
> for ( Iterator it = this.__ruleBaseEventListeners.iterator(); it.hasNext();
> ) {
> this.ruleBase.removeEventListener( (RuleBaseEventListener) it.next()
> );
> }
>
> I changed that to:
>
> for ( Iterator it = this.ruleBase.getRuleBaseEventListeners().iterator();
> it.hasNext(); ) {
> this.ruleBase.removeEventListener( (RuleBaseEventListener) it.next()
> );
> }
>
> And now works OK, no memory leak.
That is not safe, and incorrect. __ruleBaseEventListener is the list of 
rulebase listeners that the current WM adds ot the rulebase.
 public void addEventListener(RuleBaseEventListener listener) {
 this.ruleBase.addEventListener( listener );
 this.__ruleBaseEventListeners.add( listener );
 }
  When the WM is disposed it should remove it's listeners only. so it 
iterates __ruleBaseEventListener to find those, and remove them from the 
rulebase .

What you are doing is iterating the rulebase and removing ALL it's  
listeners, which means it'll remove listeners that belong to other wms.

If you are getting a leak like this, it means some how the wm is adding  
listener, that is not removed - i.e. a listener is not added to 
__ruleBaseEventListener but is still added to rulebase.

If you want this fixed for 5.3,  we need a test producing the issue by 
today.

Mark
>
> Thanks
>
>
>
> --
> View this message in context: 
> http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3394726.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-04 Thread alopez
Good news, I followed your advice and patched drools-core to prevent this,
focusing on removing all listeners:

AbstractWorkingMemory.java, line 1246:

for ( Iterator it = this.__ruleBaseEventListeners.iterator(); it.hasNext();
) {
   this.ruleBase.removeEventListener( (RuleBaseEventListener) it.next()
);
}

I changed that to:

for ( Iterator it = this.ruleBase.getRuleBaseEventListeners().iterator();
it.hasNext(); ) {
   this.ruleBase.removeEventListener( (RuleBaseEventListener) it.next()
);
}

And now works OK, no memory leak.

Thanks



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3394726.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-03 Thread Edson Tirelli
   I don't know all the details about this problem, but as far as I heard,
the leak was happening because jBPM was adding its listener to the kbase
and/or ksession and not removing it on disposals... so the easiest way to
get around the leak is to simply remove it yourself before disposing the
session.

   Whoever fixed the problem can probably give you details about how to do
that.

   Having said that, if you are using community version, I strongly
recommend you to move to 5.3 when it is released as it brings tons of fixes
and some good features. Older community versions are not maintained. If you
are a Red Hat subscriber, just open a ticket for the version you want to use
and they will provide you with patched binaries.

   Edson

2011/10/3 alopez 

> This memory leak is giving us a lot of problems... we need to iteratively
> test 400,000 items, one session for each. It was working fine with 5.1.1
> and
> now is failing.
>
> Thanks for the test case, is very simple to reproduce, but I tried running
> it with:
>
> 
>org.drools
>knowledge-api
>5.3.0.CR1
> 
> ... etc.
>
> And still fails, so I don't fully trust that this will be fixed on 5.3.0...
> do you have confirmation?
>
> I need to decide if I wait for 5.3 or if I advice to roll back to 5.1.1.
>
> Thanks
>
> Alejandro
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3391578.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-10-03 Thread alopez
This memory leak is giving us a lot of problems... we need to iteratively
test 400,000 items, one session for each. It was working fine with 5.1.1 and
now is failing. 

Thanks for the test case, is very simple to reproduce, but I tried running
it with:


org.drools
knowledge-api
5.3.0.CR1

... etc.

And still fails, so I don't fully trust that this will be fixed on 5.3.0...
do you have confirmation?

I need to decide if I wait for 5.3 or if I advice to roll back to 5.1.1.

Thanks

Alejandro

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3391578.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-30 Thread vadlam
as suggested in his post by Thomas , we are retracting the facts from memory.
we are doing it in the finally block to make sure a rule session exception
does not leave the facts in memory .

for ex, we came across an incorrect regular expression  syntax within the
rules when using incorrect syntax .

java.util.regex.PatternSyntaxException: Illegal character range near index 7
^[A-Za-Z]+

retracting the facts in finally block fixes the leak .

That, besides making sure we are reusing the StatefulSession rather than
creating a new one every time.

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3383692.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-30 Thread Michael Anstis
I believe early next week, unless something critical arises. Mark Proctor
will have the final say.

sent on the move

On 30 Sep 2011 18:55, "Jamie"  wrote:
> I recently ran into this issue and I've confirmed through testing that
Drools
> 5.3.0.CR1 in conjunction with JBPM 5.1.1 Final fixes the problem.
>
> We're currently rolling our JVMs nightly to prevent out of memory errors,
so
> I need to deploy this upgrade to production ASAP. Can anyone tell me what
> the target is for the final Drools 5.3.0 release?
>
> --
> View this message in context:
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3383181.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-30 Thread Jamie
I recently ran into this issue and I've confirmed through testing that Drools
5.3.0.CR1 in conjunction with JBPM 5.1.1 Final fixes the problem.

We're currently rolling our JVMs nightly to prevent out of memory errors, so
I need to deploy this upgrade to production ASAP.  Can anyone tell me what
the target is for the final Drools 5.3.0 release?

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3383181.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-21 Thread Mauricio Salatino
did you call ksession.dispose()?
Cheers

On Wed, Sep 21, 2011 at 1:11 PM, indian9 wrote:

> I am curretly in my production seeing memory leaks where the
> ReteooStatefulSession objects are hanging around in memory and not getting
> cleaned up. So I am trying to understand how to address the issue?
>
> Vish
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3355904.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-21 Thread indian9
I am curretly in my production seeing memory leaks where the
ReteooStatefulSession objects are hanging around in memory and not getting
cleaned up. So I am trying to understand how to address the issue?

Vish

--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3355904.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-21 Thread indian9
I have couple of questions. 

1. When do you force remove the facts from session? When you hit a wait
state? 
2. How do you recognize the end of execution of your flow? 

Thanks, 



--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3355901.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-14 Thread Swindells, Thomas
This probably isn't very optimal but it should work:

Collection factHandles = session.getFactHandles();
for(FactHandle f : factHandles) {
session.retract(f);
}

Thomas
> -Original Message-
> From: rules-users-boun...@lists.jboss.org [mailto:rules-users-
> boun...@lists.jboss.org] On Behalf Of vadlam
> Sent: 14 September 2011 02:39
> To: rules-users@lists.jboss.org
> Subject: Re: [rules-users] Memory leak in 5.2/5.3
>
>
> we are seeing similar memory leak with 5.2.0.Cr1 version of drools.
>
> are there any other alternatives such as using a different version of jbpm jar
> if that is the cause of the problem?
> we are currently using the jbpm-flow-5.1.0.Cr1.jar.
>
> If not,
>
> is there a method that removes all the facts from the ksession so that it can
> be reused?
>
> for ex, the existing code (simplified) is as follows:
>
> ksession = knowledgeBase.newStatefulKnowledgeSession();
>
> for (Object obj : objList)
> {
> ksession.insert(obj);
>
> }
>  ksession.startProcess(ruleFlowProcessName);
> ksession.fireAllRules();
>  do some response processing here
>
>
> ksession.dispose();
>
> Thomas,
>
> Can you please elaborate on what you did to clean out the facts from the
> memory ?
>
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/rules-
> users-Memory-leak-in-5-2-5-3-tp3280351p3334543.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-09-13 Thread vadlam

we are seeing similar memory leak with 5.2.0.Cr1 version of drools.

are there any other alternatives such as using a different version of jbpm
jar if that is the cause of the problem?
we are currently using the jbpm-flow-5.1.0.Cr1.jar.

If not,

is there a method that removes all the facts from the ksession so that it
can be reused?

for ex, the existing code (simplified) is as follows:

ksession = knowledgeBase.newStatefulKnowledgeSession();

for (Object obj : objList)
{
ksession.insert(obj);

}
 ksession.startProcess(ruleFlowProcessName);
ksession.fireAllRules();
 do some response processing here 


ksession.dispose();

Thomas,

Can you please elaborate on what you did to clean out the facts from the
memory ?




--
View this message in context: 
http://drools.46999.n3.nabble.com/rules-users-Memory-leak-in-5-2-5-3-tp3280351p3334543.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-08-24 Thread Swindells, Thomas
> Swindells, Thomas píše v St 24. 08. 2011 v 09:14 +0100:
> > I’ve simplified my code into the following test case which on my
> > machine after about 600 or so iterations gives an Out of memory
> > exception:
>
> Have you tried removing jBPM jar files? If it fixes the issue, then it's a 
> known
> bug that should be already fixed on master (aka. Drools 5.3.) Unfortunately
> the fix didn't make Beta1.
[Swindells, Thomas] We need it unfortunately, any idea when beta2 will be out?
I've worked round it for now by reusing the sessions (cleaning out all the 
facts before I do so) but would be nice to get a proper fix :)
>
> It's also fixed on 5.2.x branch but I don't think there will be any further 
> Drools
> releases from that.
>
> --
> Lukáš Petrovický
> QE Lead, JBoss Enterprise BRMS
> Phone: +420 532 294 123
> irc: lpetrovi, triceo
>
> Red Hat Czech, s. r. o.
> Purkyňova 99, 612 00 Brno, Czech Republic
>
>
> ___
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**

___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Re: [rules-users] Memory leak in 5.2/5.3

2011-08-24 Thread Lukáš Petrovický
Swindells, Thomas píše v St 24. 08. 2011 v 09:14 +0100:
> I’ve simplified my code into the following test case which on my
> machine after about 600 or so iterations gives an Out of memory
> exception:

Have you tried removing jBPM jar files? If it fixes the issue, then it's
a known bug that should be already fixed on master (aka. Drools 5.3.)
Unfortunately the fix didn't make Beta1.

It's also fixed on 5.2.x branch but I don't think there will be any
further Drools releases from that.

-- 
Lukáš Petrovický
QE Lead, JBoss Enterprise BRMS
Phone: +420 532 294 123
irc: lpetrovi, triceo

Red Hat Czech, s. r. o.
Purkyňova 99, 612 00 Brno, Czech Republic


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] Memory leak in 5.2/5.3

2011-08-24 Thread Swindells, Thomas
I'm in the middle of trying to upgrade our application to Drools 5.2 from 5.1 
however I keep facing out of memory issues (I've also tried on the current 5.3 
beta).
I've simplified my code into the following test case which on my machine after 
about 600 or so iterations gives an Out of memory exception:

@Test
   public void testCase() throws InterruptedException
   {
  KnowledgeBuilder kbuilder = 
KnowledgeBuilderFactory.newKnowledgeBuilder();
  KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
  kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());

  for(int i = 0; i < 1000; i++) {
 System.out.println("Run " + i);
 StatefulKnowledgeSession session = 
kbase.newStatefulKnowledgeSession();
 for(int j = 0; j < 100; j++) {
   session.insert(new byte[10240]);
 }

 session.dispose();
 session = null;
 System.gc();
  }
   }

Am I missing anything here - I'm calling session.dispose() which is all I 
believe is necessary when finishing the session, however using a profiler shows 
that all the StatefulKnowledgeSessionImpl and ReteooStatefulSessions are still 
present and therefore keeping hold of all the byte arrays and memory.

Using a profiler it shows that the GC roots of the StatefulKnowledgeSessionImpl 
are
kruntime of org.jbpm.process.instance.ProcessRuntimeImpl
kruntime of org.jbpm.process.instance.event.DefaultSignalManager
kruntime of org.jbpm.process.instance.timer.TimerManager
kruntime of org.drools.reteoo.ReteooStatefulSession

Similarly for the ReteooStatefulSession:
session of org.drools.impl.StatefulKnowledgeSessionImpl
session of org.drools.impl.StatefulKnowledgeSessionImpl
workingMemory of org.jbpm.process.instance.ProcessRuntimeImpl
workingMemory of org.jbpm.process.instance.ProcessRuntimeImpl
workingMemory of org.jbpm.process.instance.ProcessRuntimeImpl

Is this a known issue? Am I missing anything in my code above.
I guess the alternative is to reuse my sessions - what is the most efficient 
way to remove all the facts from the working memory and get it back into a 
pristine state?

Thanks,

Thomas



**
This message is confidential and intended only for the addressee. If you have 
received this message in error, please immediately notify the 
postmas...@nds.com and delete it from your system as well as any copies. The 
content of e-mails as well as traffic data may be monitored by NDS for 
employment and security purposes. To protect the environment please do not 
print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales. Registered no. 
3080780. VAT no. GB 603 8808 40-00
**
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users