Memory Leak in rails app with ruby 2.3.0 and Puma 2.15.3
<p>For some time I've been having a memory leak in my application. The current setup runs with Ruby 2.3.0, Rails 4.2 and Puma Webserver puma 2.15.3
It is recommended by Heroku to use Puma, however a lot of debugging has lead me to believe it's actual Puma Webserver which is the cause of all the troubles. During debugging I've removed most of the gems, code etc but the issue kept showing up, RAM Memory increasing until an out of memory showed up. This is why I'm 99,999% sure the leak isn't from my application. Next I installed "Thin" Webserver on my Development system and also this was not a solution. Then I also upgraded my ruby version to 2.3.0 and the leak was immediately solved, RAM usage stayed ok.</p>

<p>Due to this evolution, I upgraded my production system to Ruby 2.3.0 (thinking it was only a ruby version issue) but still I'm having the memory leak. I'm now at the point that it seems to be a combination of my Puma Webserver, together with Ruby 2.3.0...</p>

<p>Does anyone of you have any experience with Puma giving memory leaks with Ruby 2.3.0. </p>

<p>Thanks in advance,
T</p>

<p><strong>UPDATE:</strong> 
my puma.rb</p>

<pre><code>workers Integer(ENV['WEB_CONCURRENCY'] || 2)
threads_count = Integer(ENV['MAX_THREADS'] || 5)
threads threads_count, threads_count

preload_app!

rackup      DefaultRackup
port        ENV['PORT']     || 3000
environment ENV['RACK_ENV'] || 'development'

on_worker_boot do
  # Worker specific setup for Rails 4.1+
  # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
  ActiveRecord::Base.establish_connection
end
</code></pre>