Memory leak when define & undefine ruby classes

Hi

I need create ruby class at runtime and undefine it after used it.

I found JRuby never release the memory of created class, even there is
nothing referencing it.

I created a simple ruby script to reproduce the problem, please see the
attachment memory_leak.rb.

Any suggestion?

Cheers,

Li Xiao

Hi Li,
jruby is run on jvm so there is no such thing as releasing classes
when You want it, garbage collector will release them when it will
want to. If You are not experiencing out of memory exception
everything is fine.

Best greetings,
Paweł Wielgus.

2010/7/22 Xiao Li [email protected]:

Cheers,

Li Xiao


To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Pawel,

I do mean: the garbage collector could not release them. And it’s very
quickly get out of memory exception if you run the script I attached.

I also took a look at the java heap dump (a hprof file). All classes
defined at run time are in memory heap, and nothing references them,
except the super class that has a subclasses variable referencing all
subclasses. Those references are weak references, but the subclass has
a variable superClass also holds it’s super class, which I think may
cause the issue that garbage collector can not collect these subclasses.

On Jul 23, 2010, at 10:50 PM, Paweł Wielgus wrote:

2010/7/22 Xiao Li [email protected]:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email