Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Newrelic_rpm memory leak Ruby v2.1.x and 2.2.x


I seem to have a memory leak involving the newrelic_rpm when using ruby v2.1.x or v2.2.x

First noticed with newrelic_rpm v3.12.0.288, but also observed with v3.9.x and v3.8.x

Is this a known issue? Is there a known version of the newrelic_rpm that is compatible with ruby v2.1.x series?


Hey @cole1

THanks for bringing this to our attention. I would like to migrate this issue to our internal ticketing system to further investigate what is occurring.

We will post the results of that discussion here.


I would like to also say I’ve noticed this - in version and We’re on Ruby 2.2.2 and using Rails 4.2.1 and Passenger 5.0.8… Let me know if there’s any way I can help, I’ve been testing with schneems/derailed_benchmarks.


Hey @four_seven

Moving to ruby 2.1 or 2.2 from 1.93 will show an increase in memory due to ruby’s generational garbage collection. This is a new feature of Ruby and a likely offender in this issue of increased memory utilization.

It is important to note that Memory leaks will continue to increase over time, where memory usage will steadily increase, and then plateau. Can you confirm that the memory usage in your application is continually growing and never plateaus?


Hi @Architexture - yes, it seems that way. We run 3x instances of passenger per 2x Heroku dyno (1024mb total), and starting usage is around 600mb, which will happily grow to the 1024mb limit over time.

TEST_COUNT=20_000 derailed exec perf:ram_over_time for us (from derailed_benchmarks) shows it keeps growing, and even up to 30k requests the heap is still increasing.

I can’t conclusively say what’s causing it, I’m still trying to isolate.


@four_seven Thanks for following up with us with those details. I’d like to open a ticket in our ticketing system so I can gather information to look into your memory usage that you may not be comfortable posting in a public forum.

You should receive an email from us shortly with a link to the ticket. If you do not receive it, please check your spam folder first and contact us if necessary.


We seem to be seeing the same issues.

Tests with derailed show NewRelic leaving considerable amount of retained memory between requests. No other gem is doing that.

We’re running an experiment over the next couple of days. Ruby 2.0 with NR, then Ruby 2.2 without. Ruby 2.0 with NR is already using 80mb less than before, we’ll see how we get on with the other combinations.


We’ve removed NR from our app now. We’ve not seen a catastrophic increase in memory since that time (our swap memory graph looked like a line of sharks before, peaking at 2gb).

There is definitely something not right in the NR gem at the moment.


@paulleader Thanks for posting your findings to the forum. I’d like to open a Support ticket so we can gather some additional information on the memory usage you saw. Since you may not feel comfortable posting some of these details in a public forum, I’d like to open the ticket.

You should get an email from us soon with a link to the ticket. If you do not receive it, please check your spam folder first and then contact us if necessary.


Saw the issue, had to take newrelic out as it had maxed out my dyno memory allocation.

gem ‘rails’, ‘4.2.1’
postgres db
puma server:
workers Integer(ENV[‘WEB_CONCURRENCY’] || 2)
threads_count = Integer(ENV[‘MAX_THREADS’] || 5)
threads threads_count, threads_count


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

on_worker_boot do


Hi @patrickhokang,
I have opened a ticket on your behalf to follow up on this issue. You should receive an email shortly with the details.


I moved a post to a new topic: Ruby newrelic_rpm memory leak