[Ruby] Memory profiling with Rails

Scott Laird scott at sigkill.org
Wed Aug 16 17:29:39 PDT 2006


On 8/16/06, Ryan Davis <ryand-ruby at zenspider.com> wrote:
>
> On Aug 16, 2006, at 10:59 AM, Scott Laird wrote:
>
> > Thanks, this helps.  I made a few small changes, and it looks like
> > Typo's action cache is leak-free, but non-cached pages leak a couple
> > strings per hit.  I'm sure that'll be a lot of fun to find :-(.
>
> What do you mean when you say "leak"? I assume typo doesn't have any
> C code that might be creating a leak... In ruby leak would be
> something not garbage collectable. How would that be done with
> strings (without C code)?
>
> OOH... I just had a thought... add this:
>
> curr[Symbol] = Symbol.all_symbols.size

Well, the two big memory leaks that we've had so far both involved
data being pushed onto a class-scoped array and then never deleted.
That results in the objects being allocated but never freed, which is
your basic definition of a memory leak :-).

I'll add the symbol tracking tonight, along with a bit of debugging
code to see if I can extract the contents of the two extra strings
(out of *80,000* of them).


Scott


More information about the Ruby mailing list