Skip to content

Commit

Permalink
Workaround for issue #558
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <[email protected]>
  • Loading branch information
phprus committed May 26, 2023
1 parent a6834cc commit 40ca823
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/tbbmalloc/frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,14 @@ void StartupBlock::free(void *ptr)
* In theory, we only need values 0 and 2. But value 1 is nonetheless
* useful for detecting errors in the double-check pattern.
*/
static std::atomic<intptr_t> mallocInitialized{0}; // implicitly initialized to 0
#ifdef __cpp_lib_atomic_ref
// Intentionaly no init value. Guaranteed to be zero-initilized by C++ standard.
static intptr_t mallocInitializedStorage;
#define mallocInitialized std::atomic_ref<intptr_t>(mallocInitializedStorage)
#else
// Intentionaly no init value. Guaranteed to be zero-initilized by C++11 standard (but not C++20)
static std::atomic<intptr_t> mallocInitialized;
#endif
static MallocMutex initMutex;

/** The leading "\0" is here so that applying "strings" to the binary
Expand Down

0 comments on commit 40ca823

Please sign in to comment.