[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Memory leaks, maybe. need help.

doron

6/16/2009 12:05:00 PM

I am writing a server using ruby 1.8.6 patchlevel 287. It connects to
another server, fetches and process information.
Sometimes it needs to process a lot of information. It uses net/http
and REXML libraries.
My problem is that at some point the process memory usage grows from
20MB to 300MB.

I used gdb and rb_object_counts to look at the number of objects it
uses.
While the memory usage is low i see it uses 20K Strings, 1k or Arrays
etc.
While the memory usage is high i see it uses 1M Strings, 200k or
Arrays etc.
After a while, when the load is over, it again uses only 20K string
and 1K Arrays. It seems that GC worked fine.
But the memory usage I see using top is still around 300MB.

Does it mean I have memory leaks?
I read somewhere that "MRI's garbage collector never returns memory to
the system". that can explain what I see, but is it true? If so, is
there any solution?
1 Answer

Roger Pack

6/16/2009 5:55:00 PM

0


> Does it mean I have memory leaks?
> I read somewhere that "MRI's garbage collector never returns memory to
> the system". that can explain what I see, but is it true? If so, is
> there any solution?

MRI returns memory to the system if it is alloc'ed and free'ed
besides that it allocates memory in ever increasing heap sizes, which
means that they have less and less of a chance to be reclaimed [though
in 1.9 they are 2K each so less of a problem...I guess].
Anyway, to the point--try 1.9 or 1.8.x with MBARI patches they are much
better with memory [or jruby].
-=r
--
Posted via http://www.ruby-....