makes bucket variables atomic (#7179)

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2022-01-26 17:51:20 -08:00
committed by GitHub
parent 5ebe3d12df
commit 75d39d9ce5
@@ -719,8 +719,12 @@ namespace AZ {
#endif // DEBUG_ALLOCATOR
size_t mTotalAllocatedSizeBuckets = 0;
size_t mTotalCapacitySizeBuckets = 0;
// Bucket-dependent counters need to atomic since the locks that protect bucket allocations are per bucket
// So multiple threads could be updating these counters
AZStd::atomic<size_t> mTotalAllocatedSizeBuckets = 0;
AZStd::atomic<size_t> mTotalCapacitySizeBuckets = 0;
// In the case of tree allocations, there is a lock on the tree, so these counters are protected from multiple
// threads through that lock
size_t mTotalAllocatedSizeTree = 0;
size_t mTotalCapacitySizeTree = 0;
public: