Increasing memory usage over time
See original GitHub issueNewrelic memory keeps growing. How can I avoid this situation?
Description
I use newrelic to monitor async segments in my code. Recently I noticed a big memory usage because of shim.js code. Timers get created and callbacks get retained. I don’t know how it might have happened or where it is originating from.
Object×612820 | 2 | 22 665 9288 % | 245 711 28682 % | Object@5066931 | 4 | 240 % | 182 188 42461 % | elements::(object elements)[]@6552199 | 5 | 393 2640 % | 393 2640 % | [962505]::Timeout@5845729node:internal/timers:167 | 5 | 1200 % | 34 5760 % | _onTimeout::wrappedCallback()@3143791file:///Users/xxx/dev/xxx/xxx-client/node_modules/newrelic/lib/shim/shim.js:1172 | 6 | 640 % | 34 3840 %
You can see that this Object@5066931 retains 182 MB and it consists of timers that retain newrelic callback.
In my code all I do is to call:
newrelic.startSegment("segment", true, () => some_async_method())
Am I doing something wrong? What may be causing this situation?
Expected Behavior
Memory should not grow by newrelic usage.
Troubleshooting or NR Diag results
Steps to Reproduce
Your Environment
node --version v16.12.0
newrelic@8.7.0
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Hi Is there any reason that the issue is closed? We are experiencing the same problem, using newrelic ver. 8.17.1
Hey @iredchuk
Are you saying you’re experiencing memory leaks when you call something like
newrelic.startSegment("segment", true, () => some_async_method())
yourself?If so and the above debugging suggestions by @michaelgoin don’t help, then I think the same advice applies to you: please go through our technical support so that we may gather more relevant information into the problem.