My app is leaking; It’s actually more of a gush than just a leak.
I tried using the script from
to be honest, I couldn’t discern any noticeable pattern from its
From looking at top and clicking various pages on my site, I have a
idea where the leak is coming from, but I think I need some help with
understanding what exactly is capable of causing them.
I have a class with a bunch of class methods and a class variable (I
this approach over singleton instances). Through the cycle of a single
request, this class stores various objects in a class variable. At the
start of the request, before the class is used, a reset method is
to assign nil to the class variable. At the end of the request, the
left as-is, with the class variable still populated with objects. Am I
correct in my assumption that it doesn’t matter if I call the reset
at the start or end of the request cycle? In production mode, the state
the class should surely be unchanged between requests?
Other than this situation, I fail to see where else in my code a leak
occur. if I ever populate arrays in my controllers or models, they all
method scope so in theory should be collected by the GC when the method
returns. Controller classes are instantiated on each request in
Also, can anyone recommend some tools for detecting leaks other than the
script mentioned above?