-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix memory leak when tracing is enabled #3432
Conversation
In a follow up PR we might want to replace We're using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems like quite the gotcha! Thanks for fixing that!
I'm not sure I understand where that leak is coming from tho. The fix implies that the SDK doesn't get rid of the TransactionTracer
?
// Release tracked spans | ||
ReleaseSpans(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why this is required? Is something holding the reference to the TransactionTracer
? Does that reference need to be released too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I fully understand yet, no. The stack overflow thread linked above seems to imply ConcurrentBag<T>
stores stuff in a thread local and leaves it there, unless you remove it. It seems improbable that we wouldn't have picked up on something so obvious years ago if that was the case though. That would mean massive memory leaks all over our SDK (we use ConcurrentBag<T>
in a number of places).
I'll merge this PR, create a release, and then do a bit more digging on potentially replacing ConcurrentBag<T>
with a light weight custom type that isn't so mysterious. That will require some benchmarking and testing though, as it would be replacing something quite foundational.
Resolves #3431
Memory Profile prior to this PR
Memory Profile after this PR