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

NR looks leaking the objects


I do see the same where NR looks leaking the objects. I used Derailed Benchmarks and Analysed the heap dumps differences. Below screenshot was after comparing multiple dumps.

Heap one dump compared to heap Two dump

Also, after removing the New relic Gem. The memory footprint was less + Mem / Ram over time looked moving in stable direction.

Ruby newrelic_rpm memory leak

Hi @Ankit_Gupta

The agent launches a background thread where it buffers metrics that are to be sent to New Relic every 60 seconds; we refer to this as a harvest. We have a number of objects that will live for approximately 1 minute, after which references will be cleared and they are free to be garbage collected. When they will be collected is very dependent on the Ruby implementation and version.

In your experiment two heap dumps were conducted and found that there were objects allocated by the agent in earlier generations that were still present after some time. Keeping in mind how the harvest cycle works, this is expected, and it is entirely possible for some of these objects be promoted to the old generation, since 60 seconds is a long time for an object to live in a web application.

Keep in mind that Derailed Benchmarks is comparing memory addresses, and once these addresses are freed they can easily be repurposed by ruby with newly created objects. To get a more accurate idea of whether a leak is occurring, 3 consecutive heap dumps after 3 consecutive garbage collections should be conducted and the differences should be compared to see if there are any long-lived objects in the 3rd heap dump that were present in the 1st.

We’d be happy to explore this further with you. Let us know if you’d like us to open a ticket for you and we can dive deeper into this.