Memory leak??? (top reporting high memory usage under Solaris)

Discussion in 'Ruby' started by Mark Probert, Feb 9, 2005.

  1. Mark Probert

    Mark Probert Guest

    Hi ..

    Has anyone seen anything like this?

    load averages: 0.63, 0.30, 0.16
    02:07:51
    134 processes: 118 sleeping, 14 zombie, 2 on cpu
    CPU states: 77.0% idle, 16.8% user, 5.6% kernel, 0.6% iowait, 0.0% swap
    Memory: 4096M real, 2984M free, 2952M swap in use, 2357M swap free

    PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
    6683 root 1 0 4 1744M 94M cpu0 1:18 16.93% healthcollect.r
    28954 bwczkdj 1 58 0 2608K 1792K sleep 10:55 0.49% top
    ...

    The 13 mins later:

    load averages: 0.57, 0.65, 0.48
    02:20:11
    139 processes: 124 sleeping, 14 zombie, 1 on cpu
    CPU states: 93.9% idle, 3.7% user, 2.4% kernel, 0.0% iowait, 0.0% swap
    Memory: 4096M real, 2678M free, 5294M swap in use, 15M swap free

    PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND
    6683 root 1 20 4 4082M 291M sleep 9:15 12.43% healthcollect.r
    ...

    Notice that the reported memory size of the Ruby application is growing? All
    the swap gets consumed and the process dies. Looks like a memory leak
    somewhere, though I could well be mistaken. Certainly, the process reporting
    that it is using 4Gb of memory raise my eye brows.

    As background, this script runs data collection against about 220 network
    elements. The script is multithreaded, with the current thread count at 15.
    Each thread will have a dedicated telnet session to the network element. The
    data collected is sent straight to disk, then post-processed.

    I don't have access to upgrading the hardware, the swap size at all, or the
    ruby version easily.

    $ ruby -v
    ruby 1.8.0 (2003-08-04) [sparc-solaris2.8]

    Regards,

    --
    -mark. (probertm at acm dot org)
    Mark Probert, Feb 9, 2005
    #1
    1. Advertising

  2. Mark Probert

    Bill Kelly Guest

    From: "Mark Probert" <>
    >
    > I don't have access to upgrading the hardware, the swap size at all, or the
    > ruby version easily.
    >
    > $ ruby -v
    > ruby 1.8.0 (2003-08-04) [sparc-solaris2.8]


    Sorry if you already were aware of this; but you should
    typically be able to compile and install a version of
    ruby in your home directory without any superuser privileges.
    ( ./configure --prefix ~/somedir )

    Just wondering if that would give you the opportunity to
    try a different ruby version?


    Regards,

    Bill
    Bill Kelly, Feb 9, 2005
    #2
    1. Advertising

  3. Mark Probert

    llothar Guest

    Thomas Counsell wrote:
    > Hello
    >
    > With my multithreaded web-rick apps an exception thrown somewhere in
    > the code sometimes causes the memory used by ruby to spiral out of
    > control. True for me on Mac OS X with various 1.8.x installs. Hard
    > for me to repeat though, and when I have cleared all the exception
    > throwing bugs it goes away.
    >
    > Not a lot of use, but perhaps a clue. I discovered it was the
    > exceptions causing the spiral by running the code with the tracer
    > enabled (which requires a lot of patience for an app of any size)


    Correct. Exceptions and the heavy use of ccalloc can result in this
    memory leak. I got this report also from 2 of my ArachnoRuby users, but
    somebody must find a small reproduceable script for this.
    llothar, Feb 9, 2005
    #3
  4. Mark Probert

    Mark Probert Guest

    Hi ..

    On Wednesday 09 February 2005 00:01, Bill Kelly wrote:
    >
    > Just wondering if that would give you the opportunity to
    > try a different ruby version?
    >

    Unfortunately, the customer here is really strict about software on their
    production servers. I even need someone to run the commands whilst I watch
    over their shoulder :). To get a different version of Ruby is a process of
    many weeks. Though it will happen in the end ..

    Regards,

    -mark.
    Mark Probert, Feb 9, 2005
    #4
  5. Mark Probert

    Mark Probert Guest

    Hi ..

    On Wednesday 09 February 2005 04:15, llothar wrote:
    > Thomas Counsell wrote:
    > > Hello
    > >
    > > With my multithreaded web-rick apps an exception thrown somewhere in
    > > the code sometimes causes the memory used by ruby to spiral out of
    > > control.

    >
    > Correct. Exceptions and the heavy use of ccalloc can result in this
    > memory leak. I got this report also from 2 of my ArachnoRuby users, but
    > somebody must find a small reproduceable script for this.


    Thanks. I'll see what I can do.

    So exceptions, even caught ones, will trigger a memory leak? Won't the GC
    kick in and clean them up? Or is it only uncaught exceptions?


    --
    -mark. (probertm at acm dot org)
    Mark Probert, Feb 9, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JTP PR
    Replies:
    0
    Views:
    266
    JTP PR
    May 27, 2010
  2. JTP PR
    Replies:
    0
    Views:
    270
    JTP PR
    May 27, 2010
  3. Mark Probert

    memory usage under solaris

    Mark Probert, Oct 8, 2003, in forum: Ruby
    Replies:
    1
    Views:
    104
    Ben Giddings
    Oct 8, 2003
  4. JTP PR
    Replies:
    0
    Views:
    108
    JTP PR
    May 27, 2010
  5. MrsEntity
    Replies:
    20
    Views:
    474
Loading...

Share This Page