# Memory Leak

**URL:** <https://www.ruby-forum.com/t/memory-leak/150304>\
**Category:** Rails\
**Created:** [October 7, 2008, 4:40am UTC](https://www.ruby-forum.com/t/memory-leak/150304 "2008-10-07T04:40:39Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_Gregianin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Alex\_Gregianin](https://www.ruby-forum.com/u/Alex_Gregianin)\
**Post date:** [October 7, 2008, 4:40am UTC](https://www.ruby-forum.com/t/memory-leak/150304/1 "2008-10-07T04:40:39Z")

</div>

Does anybody here had any luck on tracking down memory leaks on Rails  
apps?

i’ve got a small application that no matter what i try to do,the  
mongrels processes keep growing and growing up.I’ve heard Evan made  
this gem called bleak house to help people track down memory leaks,but  
I couldnt get anything helpful from thoses graphs its generate.Does  
anybody have any suggestions?

```
 Thankz in advance!
```

---

<div class="post-metadata">

**Author:** ![Alex\_Gregianin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Alex\_Gregianin](https://www.ruby-forum.com/u/Alex_Gregianin)\
**Post date:** [October 9, 2008, 10:00am UTC](https://www.ruby-forum.com/t/memory-leak/150304/2 "2008-10-09T10:00:47Z")

</div>

Sorry I don’t have an answer for you at the moment, but I would make  
the same request.

I have recently started to experience serious memory leaks in my two  
live apps (running on different servers). I am using lighttpd and  
fastcgi on Fedora 8 and 9.

One is using Rails 2.0.2,and one Rails 1.2.6  
Ruby version 1.8.6 (2008-06-20 patchlevel 230)

I also seem to get the memory leak on my development system running  
mongrel. I am currently investigating and will post back here with  
anything I come up with that may help.

I only noticed the problem when I was investigating a hardware  
failure, but had been getting comments from users about slow responses  
for a little while.  
I am monitoring the process memory size and watch it grow every few  
requests.

If anyone can help that would be great.

Tonypm

---

<div class="post-metadata">

**Author:** ![Alex\_Gregianin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Alex\_Gregianin](https://www.ruby-forum.com/u/Alex_Gregianin)\
**Post date:** [October 9, 2008, 10:17am UTC](https://www.ruby-forum.com/t/memory-leak/150304/3 "2008-10-09T10:17:49Z")

</div>

On 9 Oct 2008, at 08:59, tonypm wrote:

> 

ruby 1.8.6 p230 is screwed and known for leaking and segfaulting.

Fred

---

<div class="post-metadata">

**Author:** ![Alex\_Gregianin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Alex\_Gregianin](https://www.ruby-forum.com/u/Alex_Gregianin)\
**Post date:** [October 14, 2008, 4:08am UTC](https://www.ruby-forum.com/t/memory-leak/150304/4 "2008-10-14T04:08:38Z")

</div>

Does patchlevel 111 have the same problem as well?

```
 I've been running ruby 1.8.6 patchlevel 111 on mac,but the

```

processes grow slightly every request.On my production server running  
debian,I’ve got ruby 1.8.5 from 2006-08-25,and because I’ve got a lot  
of traffic on my production server,memory goes away really fast!I’ll  
update to ruby 1.8.6 latest release and post the results here.

Thankz!

---

<div class="post-metadata">

**Author:** ![Alex\_Gregianin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Alex\_Gregianin](https://www.ruby-forum.com/u/Alex_Gregianin)\
**Post date:** [October 12, 2008, 6:50pm UTC](https://www.ruby-forum.com/t/memory-leak/150304/5 "2008-10-12T18:50:56Z")

</div>

Thanks Fred,

Fedora updated Ruby to:

ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]

problems now all gone away - much relieved!!

Tonypm

---

<div class="post-metadata">

**Author:** ![Alex\_Gregianin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Alex\_Gregianin](https://www.ruby-forum.com/u/Alex_Gregianin)\
**Post date:** [October 14, 2008, 12:52pm UTC](https://www.ruby-forum.com/t/memory-leak/150304/6 "2008-10-14T12:52:10Z")

</div>

On 14 Oct 2008, at 03:07, Alex Gregianin wrote:

> Does patchlevel 111 have the same problem as well?
> 
> ```
> I've been running ruby 1.8.6 patchlevel 111 on mac,but the
> 
> ```
> 
> processes grow slightly every request.On my production server running  
> debian,I’ve got ruby 1.8.5 from 2006-08-25,and because I’ve got a lot  
> of traffic on my production server,memory goes away really fast!I’ll  
> update to ruby 1.8.6 latest release and post the results here.

shouldn’t do (p230 is where the bad stuff happens).  
It is perfectly possible to have a memory leak that is your fault -  
see if you can isolate it to a segment of code that leaks

Fred

---

<div class="post-metadata">

**Author:** ![Alex\_Gregianin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/74df32/32.png) [@Alex\_Gregianin](https://www.ruby-forum.com/u/Alex_Gregianin)\
**Post date:** [October 17, 2008, 2:21am UTC](https://www.ruby-forum.com/t/memory-leak/150304/7 "2008-10-17T02:21:13Z")

</div>

We’re running mongrels on Ubuntu with Ruby 1.8.6-p114, and memory of  
each process is slowly increasing, so we have to restart them every  
couple of days or so.

Anybody else having to do this? I tried to use bleak-house, but that  
refused to work without sigsegv’ing. So I’ve written a simple action  
that walks the ObjectSpace and counts the number of objects per class  
and renders them. Nothing obvious there that would account for 20MB of  
leakage.

When we start mongrel, they use 60MB quickly, and then slowly increase  
memory every request. When they’re at 90MB or 100MB, we restart them  
(because we have 18 running on one box, and they use up lots of memory).

Have some question to you guys:

- How often do you restart mongrels?

- How much memory does your mongrel orocess use (after a couple hours of  
uptime)?

- What Ruby version is the most recommended?

thx  
Andrej
