I am tryin to resolve a memory leak problem with Rails. I can see through New Relic that the usage of memory is increasing without ever decreasing.
This is a spinoff question from a large thread ( Memory constantly increasing in Rails app ) where I am trouble shooting the problem. What I need to know now is just:
What are major reasons/factors when it comes to memory leaks in Rails?
As far as I understand:
Global variables (such as @@variable) - I have none of these
Symbols (I have not created any specifically)
Sessions - What should one avoid here? Let's say I have a session keeping track of the last query one particular user used when to text-search the site. How should I kill it off?
"Leaving references" - What does this really mean? Could you give an example?
Any other bad coding examples you can give that will typically create memory leaks?
I want to use this information to look through my code so please provide examples!
Lastly, would this be "memory leaking code"?
ProductController
...
@last_products << Product.order("ASC").limit(5)
end
will that make @last_products bloat?