<p>I wrote a small web app using ruby on rails, its main purpose is to upload, store, and display results from xml(files can be up to several MB) files.  After running for about 2 months I noticed that the mongrel process was using about 4GB of memory.  I did some research on debugging ruby memory leaks and could not find much. So I have two questions.</p>

<ul>
<li>Are there any good tools that can be used to find memory leaks in Ruby/rails?</li>
<li>What type of coding patterns cause memory leaks in ruby?</li>
</ul>

Memory leak is a problem in the current ruby implementation a good place to start about this is
http://whytheluckystiff.net/articles/theFullyUpturnedBin.html
Whytheluckystiff website doesn't exist anymore but you can find the original article here:
https://viewsourcecode.org/why/hacking/theFullyUpturnedBin.html
for a more specific answer on problems with long running ruby processes see
https://just.do/2007/07/18/heap-fragmentation-in-a-long-running-ruby-process/
maybe you could give passenger (mod_rails) a try
https://web.archive.org/web/20130901072209/http://nubyonrails.com/articles/ask-your-doctor-about-mod_rails