Memory leaks

what causes 'em?
How do I spot 'em?
How can I fix them?

I’ve got several apps running on textdrive, and they’re all consuming
too much memory and being killed all the time. I’m still a relative n00b
to Rails, and not sure how to go about fixing them. When I look in the
dev/production logs, I don’t see any obvious errors in my code, so what
else causes them?

Are there some common errors/practices in general that will cause them?

I also ran Scott L.s MemoryProfiler.rb class
(Memory leak profiling with Rails :: scottstuff.net)

but have no idea what the outputted logs from it mean.

anybody? Surely someone out there has some advice for me…

ps I develop on winXP/webrick if that helps

I’m having memory leak problems myself, but I’m not 100% certain that
it’s a leak yet.

Here’s a question for you. Are they actually leaking, or just using a
lot of memory? His log shows you the number of objects of a specific
type. For example

Top 20
+50: String (29871)
+1: Hash (1128)
+1: Time (40)
-1: Proc (512)
-5: Array (1048)

This means that the number of strings since the last logging has
increased by +50 and the total number of strings are 29871.

bump

I’m also having memory leak problems and I can’t find any good resources
on how to actually track them down. I read Scott L.'s blog entry and
installed his module, but I can’t seem to do anything useful with the
results.

My rails app creates/destroys so many strings per request that I can’t
tell the difference between a leaked string and just a string. I mean,
there seems to be a certain ebb and flow about how strings are created
an ddestroyed. Sometimes a request will leave 100+ strings behind.
Sometimes there will be a few less strings than before a request. (the
trend is for an gradual increase)

Also, the strings are FULL of random .rhtml snippets. Does Rails keep
.rhtml files in memory even after GC.start?

At what point do I know that Rails is done creating its own internal
objects?

What about other objects besides strings that might be leaking? How do I
track those down?

All I really know at this point is that my app gradually goes from 36MB
to 200MB over the course of several days.

-matthew