# Garbage collection

**URL:** <https://www.ruby-forum.com/t/garbage-collection/188601>\
**Category:** Rails\
**Created:** [May 14, 2010, 5:17pm UTC](https://www.ruby-forum.com/t/garbage-collection/188601 "2010-05-14T17:17:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmanivannancse](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@jmanivannancse](https://www.ruby-forum.com/u/jmanivannancse)\
**Post date:** [May 14, 2010, 5:17pm UTC](https://www.ruby-forum.com/t/garbage-collection/188601/1 "2010-05-14T17:17:48Z")

</div>

We have developed rails reports and deployed in server, report have some  
hierarchy levels…

Initially we have less volume of data in database table and report is  
running with fine performance…

after few months,reports get very slower, we thought that this could be  
because of data increased in database table ( nearly 11 lakhs of records  
in table)…

Then i created index and report has shown better performance than  
old…

after 1 year, again reports are showing poor performance…  
So we have decided to monitor memory related issues and used ‘top’ and  
‘free’ commands to monitor memory…

as per our analysis,

1. at start, used memory was 100MB and free memory was 500MB.

2. When i continuously used complex report(i visit some hierarchy level  
or sub links) ,at first level shows good performance…then i move  
forward to next and next level reports the performance get very poor.

3. The free memory was reduced to 150MB…used memory was increased to  
400MB…

4. the free memory is not released even after the report shows result…

So we suggest to release used memory by forcing garbage collection  
manually…

Kindly tell me how to call garbage collection manually or any other  
ideas are also welcome…

Thanks…
