Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

memory reductions in worker process

There's absolutely no need to keep the OptionParser around in
worker processes.
  • Loading branch information...
commit 4beeb52b1c52ea4486dea13cebe2a8438a9f2139 1 parent e9e7a1c
Eric Wong authored
View
1  bin/unicorn
@@ -106,6 +106,7 @@ op = OptionParser.new("", 24, ' ') do |opts|
end
app = Unicorn.builder(ARGV[0] || 'config.ru', op)
+op = nil
if $DEBUG
require 'pp'
View
1  bin/unicorn_rails
@@ -186,6 +186,7 @@ def rails_builder(ru, op, daemonize)
end
app = rails_builder(ARGV[0], op, rackup_opts[:daemonize])
+op = nil
if $DEBUG
require 'pp'
View
4 lib/unicorn.rb
@@ -31,9 +31,9 @@ class ClientShutdown < EOFError
# app (which we defer based on the outcome of "preload_app" in the
# Unicorn config). The returned lambda will be called when it is
# time to build the app.
- def self.builder(ru, opts)
+ def self.builder(ru, op)
# allow Configurator to parse cli switches embedded in the ru file
- Unicorn::Configurator::RACKUP.update(:file => ru, :optparse => opts)
+ op = Unicorn::Configurator::RACKUP.merge!(:file => ru, :optparse => op)
# always called after config file parsing, may be called after forking
lambda do ||
View
4 lib/unicorn/http_server.rb
@@ -458,7 +458,9 @@ def murder_lazy_workers
def after_fork_internal
@ready_pipe.close if @ready_pipe
- @ready_pipe = nil
+ Unicorn::Configurator::RACKUP.clear
+ @ready_pipe = @init_listeners = @config = @before_exec = @before_fork = nil
+
srand # http://redmine.ruby-lang.org/issues/4338
# The OpenSSL PRNG is seeded with only the pid, and apps with frequently
Please sign in to comment.
Something went wrong with that request. Please try again.