[jboss-jira] [JBoss JIRA] Closed: (JBRULES-1279) Memory leak in release 4.0.2
Mark Proctor (JIRA)
jira-events at lists.jboss.org
Wed Oct 17 15:12:04 EDT 2007
[ http://jira.jboss.com/jira/browse/JBRULES-1279?page=all ]
Mark Proctor closed JBRULES-1279.
---------------------------------
> Memory leak in release 4.0.2
> ----------------------------
>
> Key: JBRULES-1279
> URL: http://jira.jboss.com/jira/browse/JBRULES-1279
> Project: JBoss Drools
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Affects Versions: 4.0.2
> Environment: tested with windows jdk5 and jdk6
> Reporter: Paul Jackson
> Assigned To: Edson Tirelli
> Fix For: 4.0.3, 4.1.0, 4.0.2_SOA_4.2-CP1
>
>
> I have observed memory leaks in our application after upgrading to the latest 4.0.2 release. I have replicated the problem with the sample code below:
> DroolsTest.java
> import java.io.InputStreamReader;
> import java.io.Reader;
> import org.drools.RuleBase;
> import org.drools.RuleBaseFactory;
> import org.drools.StatefulSession;
> import org.drools.compiler.PackageBuilder;
> import org.drools.rule.Package;
> public class DroolsTest {
> public void run() throws Exception {
>
> RuleBase ruleBase = createRuleBase();
> long counter = 0;
> while(true) {
> StatefulSession session = ruleBase.newStatefulSession(false);
> if(++counter % 100 == 0) {
> System.out.println(counter);
> }
> session.dispose();
> }
> }
>
> private RuleBase createRuleBase() throws Exception {
> Reader source = new InputStreamReader( this.getClass().getResourceAsStream( "HelloWorld.drl" ) );
> PackageBuilder builder = new PackageBuilder();
> builder.addPackageFromDrl( source );
> if ( builder.hasErrors() ) {
> System.out.println( builder.getErrors().toString() );
> throw new RuntimeException( "Unable to compile \"HelloWorld.drl\".");
> }
> Package pkg = builder.getPackage();
>
> RuleBase ruleBase = RuleBaseFactory.newRuleBase();
> ruleBase.addPackage( pkg );
> return ruleBase;
> }
>
> public static void main(String[] args) throws Exception {
> new DroolsTest().run();
> }
> }
> HelloWorld.drl
> #list any import classes here.
> #declare any global variables here
> rule "Your First Rule"
>
> when
> #conditions
> then
> #actions
>
> end
> rule "Your Second Rule"
> #include attributes such as "salience" here...
> when
> #conditions
> then
> #actions
>
> end
> When I run this with release 4.0.1 I have to manually break the program to get it to stop.
> When I run with release 4.0.2 it reaches about 14000 iterations before crashing with an out of memory error.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list