I am trying to solve a memory leak problem using Rails. I can see through New Relic that memory usage is increasing, not decreasing.
This is a spinoff question from a large topic ( Memory is constantly growing in the Rails application ), where I find it difficult to solve the problem. Now I need to know:
What are the main causes / factors associated with memory leaks in Rails?
As far as I understand:
Global variables (such as @@ variable) - I don't have any of these
Symbols (I didn’t specifically create)
Sessions - What should I avoid here? Let me say that I have a session that tracks the last request, which is used by a specific user in a text search on the site. How do I kill him?
Leaving Links - What Does It Mean? Could you give an example?
Any other examples of bad coding that you can give tend to create memory leaks?
I want to use this information to view my code, so please include examples!
Finally, will it be a "memory leak code"?
ProductController
...
@last_products << Product.order("ASC").limit(5)
end
will this make @last_products bloat?
source
share