]> git.openstreetmap.org Git - rails.git/blobdiff - public/dispatch.fcgi
Run GC if we hit the memory limit, and only restart if we are still too big.
[rails.git] / public / dispatch.fcgi
index af8434a76dead81c4d50ba756f9bac3aeec3b662..d3f9adf20d488d663ae2d60bfc2c46475f3fc3d9 100755 (executable)
@@ -29,8 +29,12 @@ protected
 
     # Restart if we've hit our memory limit
     if resident_size > 512
-      dispatcher_log :info, "restarting due to memory limit"
-      restart!
+      run_gc!
+
+      if resident_size > 512
+        dispatcher_log :info, "restarting due to memory limit"
+        restart!
+      end
     end
   end