<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2>Mark,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2> </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2> We were using JRockit's Mission Control to monitor
memory. The working memory footprint just kept growing even though we were only
querying working memory and weren't adding new facts. I'm new to the Mission
Control application and couldn't figure out how to configure it to verify
queries were causing the footprint to grow. I just made that assumption since we
were only querying working memory and not adding new facts.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2> I will look into it more today, and use JProfiler to
verify queries are causing the footprint to grow. If I verify that, I will put
together a use case that demonstrates the problem. Thanks for looking into this
for me.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2>Dan</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=890231412-04052009><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV align=left><FONT face=Arial size=2>Daniel Quinn</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>Fedex - Custom Critical</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>Software Specialist I</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>234.310.4090(x2586)</FONT></DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Mark
Proctor<BR><B>Sent:</B> Thursday, April 30, 2009 9:13 PM<BR><B>To:</B> Rules
Users List<BR><B>Subject:</B> Re: [rules-users] queries in Drools
5.0<BR></FONT><BR></DIV>
<DIV></DIV>Quinn, Dan wrote:
<BLOCKQUOTE
cite=mid:1E5E8FAA97B3F149BACC39DAA9E63DF3085E2934@EXCHVS01.mail.blue.fedex.com
type="cite">
<META content="MSHTML 6.00.6000.16825" name=GENERATOR>
<DIV dir=ltr align=left><SPAN class=296013715-29042009><FONT face=Arial
color=#0000ff size=2>We are writing an app which has a large number of facts.
This app also needs to make lots of queries against working memory.
Our memory footprint seems to be expanding at an undesirable rate due to the
number of queries made against working memory. It is increasing at a rate
where after a couple of days the app will consume all the resources on
the machine. This app is stateful and needs to stay up for a long
duration. Rebooting it every couple of day to clean up working
memory would not be acceptable.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=296013715-29042009></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=296013715-29042009><FONT face=Arial
color=#0000ff size=2> It seems to me that the queries are being added to
working memory as facts, but the query is not retracted after its result is
returned. Is that true? Is there something I need to do so query facts are
removed after the results are returned to keep the size of working memory
down?</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=296013715-29042009></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=296013715-29042009><FONT face=Arial
color=#0000ff size=2>Has this behavior changed since Drools 4.0.7. I don't
recall seeing this issue running against the older version of
Drools.</FONT></SPAN></DIV></BLOCKQUOTE>no, after a query the memory should
return to before the query was executed. If it's not, then there is a memory
leak, maybe the retracting of the query driver is not happening. If you look at
the query method, it just inserts a DroolsQuery object and retracts it and
gathers up the results inbetween. If you have jprofiler you can have a good idea
if the DroolsQuery object is getting GC'd, or if they are building
up.<BR><BR>Mark<BR>
<BLOCKQUOTE
cite=mid:1E5E8FAA97B3F149BACC39DAA9E63DF3085E2934@EXCHVS01.mail.blue.fedex.com
type="cite">
<DIV dir=ltr align=left><SPAN class=296013715-29042009></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=296013715-29042009><FONT face=Arial
color=#0000ff size=2>Thanks,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=296013715-29042009><FONT face=Arial
color=#0000ff size=2>Dan</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Arial size=2>Daniel Quinn</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>Fedex - Custom Critical</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>Software Specialist I</FONT></DIV>
<DIV align=left><FONT face=Arial size=2>234.310.4090(x2586)</FONT></DIV>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> <A class=moz-txt-link-abbreviated
href="mailto:rules-users-bounces@lists.jboss.org">rules-users-bounces@lists.jboss.org</A>
[<A class=moz-txt-link-freetext
href="mailto:rules-users-bounces@lists.jboss.org">mailto:rules-users-bounces@lists.jboss.org</A>]
<B>On Behalf Of </B>David Sinclair<BR><B>Sent:</B> Friday, April 03, 2009 3:20
PM<BR><B>To:</B> Rules Users List<BR><B>Subject:</B> Re: [rules-users]
Locating facts via slot values<BR></FONT><BR></DIV>Here you go
WolfGang<BR><BR>rule shoot-3 <BR>
when<BR> $h
: Hunter( $target :
target)<BR>
Animal(this == $target)<BR>
then<BR> $h.shoot( $a
);<BR> retract( $a );<BR>end<BR><BR>
<DIV class=gmail_quote>2009/4/3 Wolfgang Laun <SPAN dir=ltr><<A
href="mailto:wolfgang.laun@gmail.com"
moz-do-not-send="true">wolfgang.laun@gmail.com</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">Given
a working memory containing a large number of rather static facts which are
from several subclasses (Ape, Bear, Crocodile,...) of some base class
(Animal) and a single fact of class Hunter with a field target of type
Animal, the shooting of an animal might be written with a rule like
this:<BR><BR>rule shoot-1<BR>
when<BR> ?h : Hunter( ?target :
target )<BR> ?a :
Animal()<BR> eval(?target ==
?a)<BR> then<BR>
?h.shoot( ?a );<BR> retract( ?a
);<BR>end<BR><BR>Avoiding eval (which is said to be inefficient), it could
also be written as<BR><BR>rule shoot-2<BR>
when<BR> ?a:
Animal()<BR> ?h : Hunter(
target == ?a )<BR>
then<BR> ?h.shoot( ?a
);<BR> retract( ?a
);<BR>end<BR><BR>This, however, places the pattern with many instances up
front, which is (AFAIK) not so good in a Rete implementation.<BR><BR>Which
one is to be preferred in Drools?<BR><BR>Ideally, one might want to write
<BR><BR>rule shoot-3<BR>
when<BR> ?h : Hunter( ?target :
target )<BR> ?a == ?target :
Animal()
### not valid DRL<BR>
then<BR> ?h.shoot( ?a
);<BR> retract( ?a );<BR>end<BR><BR>This
avoids eval, has the single instance fact up front, but it isn't
available.<BR><FONT
color=#888888><BR>-W<BR><BR><BR><BR></FONT><BR>_______________________________________________<BR>rules-users
mailing list<BR><A href="mailto:rules-users@lists.jboss.org"
moz-do-not-send="true">rules-users@lists.jboss.org</A><BR><A
href="https://lists.jboss.org/mailman/listinfo/rules-users" target=_blank
moz-do-not-send="true">https://lists.jboss.org/mailman/listinfo/rules-users</A><BR><BR></BLOCKQUOTE></DIV><BR><PRE wrap=""><HR width="90%" SIZE=4>
_______________________________________________
rules-users mailing list
<A class=moz-txt-link-abbreviated href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</A>
<A class=moz-txt-link-freetext href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</A>
</PRE></BLOCKQUOTE><BR></BODY></HTML>