# My app uses a lot of memory

**URL:** <https://www.ruby-forum.com/t/my-app-uses-a-lot-of-memory/106470>\
**Category:** Rails\
**Created:** [June 11, 2007, 12:37am UTC](https://www.ruby-forum.com/t/my-app-uses-a-lot-of-memory/106470 "2007-06-11T00:37:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@kay](https://www.ruby-forum.com/u/kay)\
**Post date:** [June 11, 2007, 12:37am UTC](https://www.ruby-forum.com/t/my-app-uses-a-lot-of-memory/106470/1 "2007-06-11T00:37:20Z")

</div>

Hi guys.

My problem is the follow:

I use mongrel for my app and in normal use the app use 30 MB +/- of  
memory, the problem is when one of my funcionality is used, is a query  
that return a very big amouth of data, and the memory fire to 40 MB,  
till here no problem, the problem is that the memory never goes back to  
the 30 MB again, even if i dont use that funcionality again the momory  
remains in the 40 MB for ever ( till some restart ).  
At begining i thought that this was a GC problem and have tried to find  
and fix it, but with no success.

Any ideas about what can i do ?

---

<div class="post-metadata">

**Author:** ![kay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@kay](https://www.ruby-forum.com/u/kay)\
**Post date:** [June 11, 2007, 1:44am UTC](https://www.ruby-forum.com/t/my-app-uses-a-lot-of-memory/106470/2 "2007-06-11T01:44:29Z")

</div>

is your functionality somehow related to rmagick?  
in general a bit of growth after application start is ok, while it  
cache classes, but if it keep growing, you should check why it does.  
40mb is not so big footprint for mongrel process, by the way.

On Jun 11, 1:37 am, Helder O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![kay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@kay](https://www.ruby-forum.com/u/kay)\
**Post date:** [June 11, 2007, 11:23am UTC](https://www.ruby-forum.com/t/my-app-uses-a-lot-of-memory/106470/3 "2007-06-11T11:23:06Z")

</div>

liquidautumn wrote:

> is your functionality somehow related to rmagick?  
> in general a bit of growth after application start is ok, while it  
> cache classes, but if it keep growing, you should check why it does.  
> 40mb is not so big footprint for mongrel process, by the way.
> 
> On Jun 11, 1:37 am, Helder O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

no rmagik, is just a query with many results, is not the 40MB that  
scares me, is what it can be consuming in the near futhur, becauz that  
query wil return much more results in some time…

---

<div class="post-metadata">

**Author:** ![kay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@kay](https://www.ruby-forum.com/u/kay)\
**Post date:** [June 11, 2007, 11:30am UTC](https://www.ruby-forum.com/t/my-app-uses-a-lot-of-memory/106470/4 "2007-06-11T11:30:23Z")

</div>

> no rmagik, is just a query with many results, is not the 40MB that  
> scares me, is what it can be consuming in the near futhur, becauz that  
> query wil return much more results in some time…

Personally I would just wait it out and keep an eye on it. As the last  
poster said, 40MB isn’t a lot, and you don’t really have enough  
information yet. Have you thought about stress testing your app?

---

<div class="post-metadata">

**Author:** ![kay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ed655f/32.png) [@kay](https://www.ruby-forum.com/u/kay)\
**Post date:** [June 11, 2007, 12:56pm UTC](https://www.ruby-forum.com/t/my-app-uses-a-lot-of-memory/106470/5 "2007-06-11T12:56:36Z")

</div>

Helder O. wrote:

> query wil return much more results in some time…  
> Make the query return less then. Rails is not built for processing of  
> huge datasets, so most likely you should either be able to make another  
> query that returns just the data needed or else you should put the query  
> into some kind of background job and cache the results or whatnot.

An explanation of what you’re trying to do would be most helpful if you  
would like further advice.

–  
Cheers,

- Jacob A.
