# How to use Memory Profiler

**URL:** <https://www.ruby-forum.com/t/how-to-use-memory-profiler/110994>\
**Category:** Rails\
**Created:** [August 1, 2007, 7:52pm UTC](https://www.ruby-forum.com/t/how-to-use-memory-profiler/110994 "2007-08-01T19:52:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Rumble](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@Mike\_Rumble](https://www.ruby-forum.com/u/Mike_Rumble)\
**Post date:** [August 1, 2007, 7:52pm UTC](https://www.ruby-forum.com/t/how-to-use-memory-profiler/110994/1 "2007-08-01T19:52:03Z")

</div>

Hello

I’m looking to do some profiling of my app using the MemoryProfiler  
class at

> **[Memory leak profiling with Rails :: scottstuff.net](https://scottstuff.net/blog/articles/2006/08/17/memory-leak-profiling-with-rails/index.html)**
>
> One of my long-running problems with Rails (and Ruby in general) is that it’s difficult to debug memory leaks. I’ve had a number of cases where I’ve stuck something into a long-lived array or hash and discovered much later that my Ruby process was...

which I know is a popular choice for this kind of thing.

I’m having a bit of a blank moment in getting this working. The blog  
post says to just load the code and then run MemoryProfiler.start, but  
I’m not sure of how to actually load the code, should it be in /lib or  
somewhere like that, or do I explicitly need to load it using irb? The  
comments on the blog post say that MemoryProfiler.start should be  
placed at the very bottom of environment.rb, is that correct?

Any help from anyone who’s used this script before will be  
appreciated!

Thanks.
