-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Workaround for issue #558 #714
base: master
Are you sure you want to change the base?
Conversation
I've compiled this branch using W11 and VS 2022, and this issue is not reproducible.
Since Jan 2023, Windows 7 and Windows 8.1 are not supported (https://learn.microsoft.com/en-us/lifecycle/products/windows-81) |
In any way, the initialization of an
I think the best way would be a simple |
IMHO in C++ 11 it is perfectly valid code, as in C++11 constructor of
Why not use #if __cpp_lib_atomic_ref
//intentionaly no init value. Guranteed to be zero-initilized by C++ standard.
static intptr_t mallocInitializedStorage;
static std::atomic_ref<intptr_t> mallocInitialized{mallocInitializedStorage};
#else
//intentionaly no init value. Guranteed to be zero-initilized by C++11 standard (but not C++20)
static std::atomic<intptr_t> mallocInitialized;
#endif |
Maybe not:
But I'm not sure. The problem is the thread-safe of initialization in Windows. I will suggest another solution (It does not depend on the thread-safety of the std::atomic_ref constructor): #if __cpp_lib_atomic_ref
// intentionaly no init value. Guranteed to be zero-initilized by C++ standard.
static intptr_t mallocInitializedStorage;
#define mallocInitialized std::atomic_ref<intptr_t>(mallocInitializedStorage)
#else
// intentionaly no init value. Guranteed to be zero-initilized by C++11 standard (but not C++20)
static std::atomic<intptr_t> mallocInitialized;
#endif What do you think about it? |
PR updated. |
Rebased and ping. |
Signed-off-by: Vladislav Shchapov <[email protected]>
Signed-off-by: Vladislav Shchapov [email protected]
Description
test_malloc_shutdown_hang (Debug build): Assertion isMallocInitialized() failed
Fixes #558 (workaround)
Type of change
Choose one or multiple, leave empty if none of the other choices apply
Add respective label(s) to PR if you have permissions
Tests
Documentation
Breaks backward compatibility
Notify the following users
@alexey-katranov, @anton-potapov
Other information