Is there anything that can cause a memory leak when using JRuby from Java?

Hello, I know that this is a broad question, but I’m wondering if there
any known pitfalls when using JRuby from within a Java program?

I have a ScriptingContainer in which I load my code…I went to great
lengths no to reload code a bunch, etc. However, somehow I am getting a
memory leak. If I am creating objects in the Ruby environment, will they
garbage collected? I realize that is kind of a silly question since I
believe that the JVM handles Garbage Collection not the language, I am
wondering if something weird is going on with the bridge.

My use case looks something like this.

static ScriptingContainer which has the script.

Instantiate a couple of classes using callMethod(class object,“new”).

Now, with one of those instantiated classes – let’s call it C – I will
call a method on it a bunch. I convert from my data types to ruby types

public static RubyArray pigTupleToRbArray(Ruby ruby, Tuple t) throws

ExecException {
RubyArray rubyArray = ruby.newArray();
for (Object object : t.getAll()) {
rubyArray.add(pigToRuby(ruby, object));
return rubyArray;

This is somewhat specific to the project I’m working on (Apache Pig, for
interested), but a Tuple is just an object that can contain anything,
and is
converted to an array in Ruby. If this method was called a million times
a row, are there cases in which it would cause problems?

Let me know if there is any more information I can provide.

Thank you very much for your help.