[rjb-users] Memory Growth

Chris O'Meara chris at omeara.com
Tue Feb 5 08:28:32 EST 2008


Arton,

Thanks for the insight into RJB's interactions with the JVM.  We're
profiling our JVM and it appears to be garbage collecting properly.

I believe the memory growth occurs in the Ruby interpreter.  Can you
give me any hints regarding how RJB interacts with the Ruby GC?

Thanks,
Chris

On 2/5/08, arton <arton at e07.itscom.net> wrote:
> Hi Chiris
>
> Rjb takes no risk GC strategy. It releases logically safe objects only.
> That means arguments and returned objects. For example String object
> that passed from Java methods or Array object that Rjb passes to JVM are
> released by Rjb and JVM can collect them.
> In contrast, Rjb never release any meta data such as Classes, Methods,
> Fields etc. The objects remain in the process forever.
> So If you import many Java classes, or Classes that defines many methods causes
> memory growth.
>
> Also, you can set special flags to JVM in Rjb::load method's second
> argument. it taks an array of strings, each string contains one flag.
> for example
> Rjb::load nil, ['-verbose:gc']
> turns on verbose:gc flag (JVM emits GC status to stdout).
> If you'd like to set some specific flag
> Rjb::load nil, ['-X***', '-X***' ...]
>
> Best regards.
>
> On Mon, 4 Feb 2008 20:48:20 -0500
> "Chris O'Meara" <chris at theomearas.net> wrote:
>
> > Hi everyone,
> >
> > I have a Rails app which uses RJB extensively to integrate commercial
> > Java libraries.  Mid-way through the project we encountered some Java
> > out-of-memory errors and used a Java profiler to track those problems
> > down and clean them up.  Now we're seeing problems with our Ruby
> > process growing to varying degrees on various platforms.  (We're
> > tracking RSS to determine the process size.)  On a MacBook Pro running
> > Leopard on Mongrel process stays around 100MB; about 200MB on VMWare
> > running CentOS 4; about 800MB on a 4-way RHEL 4 server.
> >
> > Is there anything RJB-specific I should know about as I start
> > profiling my app?  Any ideas what could cause the Ruby process to grow
> > so dramatically?  Any profiler suggestions?
> >
> > Thanks in advance,
> > Chris
> >
> > _______________________________________________
> > rjb-users mailing list
> > rjb-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rjb-users
>
> --
> arton
>
> _______________________________________________
> rjb-users mailing list
> rjb-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rjb-users
>


More information about the rjb-users mailing list