-
Notifications
You must be signed in to change notification settings - Fork 449
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
[SDK] Valgrind errors on std::atomic variables #2243
Comments
The issue is that std::atomic variables are only constructed using the default contructor. According to cppreference, A better way is to invoke a constructor that passes an initial value, instead of using the default constructor. For example:
Verified that this fixes the valgrind errors. Please ignore the Every std::atomic used in the code base is potentially affected. |
Verified with valgrind the following. Default initializationRef: https://en.cppreference.com/w/cpp/language/default_initialization
This fails. Value initializationRef: https://en.cppreference.com/w/cpp/language/value_initialization
This seemed to work, not sure why. Direct initializationRef: https://en.cppreference.com/w/cpp/language/direct_initialization
This works. Direct List initializationRef: https://en.cppreference.com/w/cpp/language/list_initialization
This works. |
Using opentelemetry-cpp 1.10.0, clang 15.0.7, valgrind 3.18.1
When exporting metrics using a periodic metric readers,
and running valgrind,
the following errors are reported:
The offending lines are:
The text was updated successfully, but these errors were encountered: