Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Memory leaks, maybe. need help.

Reply
Thread Tools

Memory leaks, maybe. need help.

 
 
doron
Guest
Posts: n/a
 
      06-16-2009
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?
 
Reply With Quote
 
 
 
 
Roger Pack
Guest
Posts: n/a
 
      06-16-2009

> 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-forum.com/.

 
Reply With Quote
 
 
 
 
Charles Oliver Nutter
Guest
Posts: n/a
 
      07-03-2009
On Tue, Jun 16, 2009 at 12:54 PM, Roger Pack<> wrote:
> 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].


I'd definitely recommend trying JRuby. There's a few knobs you can
turn to keep memory under a specific size (default is to let it grow
no larger than 512MB heap, but many apps will run in a lot less) which
means it won't use up all available memory unless you tell it to. And
though it uses more memory out of the box, if you have a large dataset
or heavy object churn and high loads, JRuby does extremely well.

- Charlie

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Patriot Memory PDC1G5600ELK Memory Review Silverstrand Front Page News 0 09-07-2005 02:24 AM
Differences between Sony Memory Stick & memory Stick Pro vs Memory Stick Duo? zxcvar Digital Photography 3 11-28-2004 10:48 PM
RAM Memory or virual memory Julián Sanz García ASP .Net 4 11-12-2004 06:25 PM
GC does not release memory...memory keeps growing!!! Mahesh Prasad ASP .Net 1 02-22-2004 08:40 AM
AspNet Process Memory Issue on Win2k Server - Peformance is fine - Memory usuage doesn't stop growing Cy Huckaba ASP .Net 1 06-26-2003 04:00 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57