Run GC if we hit the memory limit, and only restart if we are still too big.
authorTom Hughes <tom@compton.nu>
Sun, 26 Apr 2009 17:01:59 +0000 (17:01 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 26 Apr 2009 17:01:59 +0000 (17:01 +0000)
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