# Memory, memory, memory

**URL:** <https://www.ruby-forum.com/t/memory-memory-memory/182556>\
**Category:** Rails\
**Created:** [January 29, 2010, 9:09pm UTC](https://www.ruby-forum.com/t/memory-memory-memory/182556 "2010-01-29T21:09:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PierreW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@PierreW](https://www.ruby-forum.com/u/PierreW)\
**Post date:** [January 29, 2010, 9:09pm UTC](https://www.ruby-forum.com/t/memory-memory-memory/182556/1 "2010-01-29T21:09:45Z")

</div>

Hi guys,

I am currently “hunting” leaks in my app, and either I don’t quite  
understand how ruby/rails handle memory, or there are some “features”  
of Rails I am not aware of. And indeed, I found - for example - this  
comment on this group (from Ezra):

You are going to see massive memory usage like this anytime you load  
more then 500 -1000 activerecord objects at once. There is quite a bit  
of memory overhead per AR object instantiation so ruby allocates a  
bunch or ram to hold the records. Once the dataset is no longer needed  
ruby doesn’t like to give ram back to the OS, instead it tends to keep  
the memory around for use by the interpreter later.

Could you recommend a “reference” article, blog post or doc where this  
sort of things are explained? I really don’t know how I could have  
“guessed” this (and I was getting crazy trying to understand where the  
memory was going).

Thanks!  
Pierre

---

<div class="post-metadata">

**Author:** ![PierreW](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/da6949/32.png) [@PierreW](https://www.ruby-forum.com/u/PierreW)\
**Post date:** [January 29, 2010, 9:38pm UTC](https://www.ruby-forum.com/t/memory-memory-memory/182556/2 "2010-01-29T21:38:07Z")

</div>

PierreW wrote:

> Hi guys,
> 
> I am currently “hunting” leaks in my app, and either I don’t quite  
> understand how ruby/rails handle memory, or there are some “features”  
> of Rails I am not aware of. And indeed, I found - for example - this  
> comment on this group (from Ezra):
> 
> Thanks!  
> Pierre

The way Rails handles memory and allocation has changed with time and  
versions. Your best bet is in fact to ask here… 🙂
