Bogdan I. <[email protected]…> writes:
Where are the memory leaks and what is the way to fix them?I’m working on a
game that was fairly stable in terms the memory consumption and it was
at around 200MB. Recently it has gone crazy, and unless I restart it, it
straight up to 350-400+MB after 30 minutes-1hour.
I am using Apache 1.3+fcgi in production mode.Also the dispatch.fcgi processes
take a really high toll (3-5%) on the CPU. ( 2.4GZ Xeon with 2
hosted (still) on a shared machine I have to constantly keep an eye on
Any ideas, suggestions?Thanks,Bogdan
Two things to look at:
- What garbage collection settings do you have in public/dispatch.fcgi?
use this syntax:
RailsFCGIHandler.process! nil, 50
Then garbage collection will NOT run until after 50 requests. This one
bit us a
while ago. Use the default instead if your dispatch.fcgis are growing:
- Here’s a good article on finding leaky objects in Ruby. The tools
terribly sophisticated but they work just fine if you’re willing to
little bit of time chasing your leak.
I got the best results out of using this code to analyze controller
invoked through functional tests. Don’t be afraid to use vendor/plugins
override (and inject measurement code) into base Rails classes if the
doesn’t appear to be in your code.
Best of luck,