Open vincentzzh33 opened 6 years ago
Yes!! We are also facing memory leak in newStandardMeter & newEWMA. Attached pprof graph screenshot for reference. Please help.
Yes!! We are also facing memory leak in newStandardMeter & newEWMA. Attached pprof graph screenshot for reference. Please help.
If you need more info, I can provide.
Any Update on this?
Any Update?
Is anyone that is running into this registering their Meter
s with the registry in go-metrics? I just refactored registry to use a sync.Map instead of a mutex managed map and removing its switch() for what to allow to register and my memory leaks have completely stopped. In my case it kept calling NewStandardMeter or NewEWMA because the metrics didn't exist in the registry already
@luzhuqun @shriram1993 @vincentzzh33
Identified the issue: Its happening because we are passing NewMetric object with every metric log. Instead it should be function, which will be called when new Metric object is required.
Before: .RcRegistry.GetOrRegister(timerName, rcmetric.NewTimer()).(rcmetric.Timer)
After: (Correct) .RcRegistry.GetOrRegister(timerName, rcmetric.NewTimer).(rcmetric.Timer)
Any Update on this?
Identified the issue: Its happening because we are passing NewMetric object with every metric log. Instead it should be function, which will be called when new Metric object is required.
Before: .RcRegistry.GetOrRegister(timerName, rcmetric.NewTimer()).(rcmetric.Timer)
After: (Correct) .RcRegistry.GetOrRegister(timerName, rcmetric.NewTimer).(rcmetric.Timer)
newStandardMeter newEWMA these two memory is keeping increase until crash when i using sarama as httpserver to receive kafka request