Fwd: Memory problem with embedded jruby

Hi,

I am writing a test framework in Java. The framework would run a bunch
of ruby scripts.
The scripts should be independent (they should not share any global
variables). They would only share a single Java object with some data
concerning my system under test.

The thing is that it seems that the variables from inside the script
are not garbage collected, and after executing several tests I run out
of memory.

The code for the looks as follows:

MyTestContext testCotnext = Â new MyTestContext();

ScriptingContainer engine = new ScriptingContainer(
LocalContextScope.SINGLETHREAD, LocalVariableBehavior.TRANSIENT);

while(hasMoreTests()){
 String test = getNextTest();
 engine.put("$c", testContext);
 engine.runScriptlet(test);
 engine.clear();
}

Is there a way to reset the ScriptingContainer so that the remains of
the previous executions get garbage collected?

Regards,

Maciek


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

On Thu, Sep 9, 2010 at 8:22 AM, Maciej K. [email protected]
wrote:

of memory.
engine.put("$c", testContext);
engine.runScriptlet(test);
engine.clear();
}

Is there a way to reset the ScriptingContainer so that the remains of
the previous executions get garbage collected?

I think this is probably a bug. Currently, I’m working on embedding
API’s sharing variable to fix bugs. While I’m debugging, I found
constants were saved in other classes in JRuby than I supposed to. So,
those were not cleared up. Others might have the similar bugs.
If possible, would you give us the code you ran by a runScriptlet
method? Also, would you file this issue in JIRA?

-Yoko


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Sep 9, 2010, at 5:22 AM, Maciej K. wrote:

of memory.
engine.put("$c", testContext);
Maciek
ScriptingContainer also has an instance method ‘terminate’ you can call.
depending on what OS you’re on, you may be running into this bug:
http://jira.codehaus.org/browse/JRUBY-5053

Cheers,
Mike


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs