-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Storage Execution
-
Fully Compatible
-
ALL
-
Storage Execution 2025-05-12
-
200
-
None
-
3
-
TBD
-
None
-
None
-
None
-
None
-
None
-
None
We store _numPartitions atomic words to track total bytes allocated in a vector _bytesAllocated. When a thread allocates or deallocates, it goes to its hashed index to increment or decrement the number of bytes. When a thread tries to get the total number of bytes allocated, it goes through _bytesAllocated to sum up all elements.
This can race with other threads who are concurrently incrementing and decrementing in the vector. One thread could increment on one side of the cursor of the reader and another thread can decrement on the other. This can result in both undercounting and overcounting.
The overcounting is less incorrect since the reader essentially got the result of an earlier point in time. The undercounting is slightly worse but we may not want to sacrifice the performance for a more accurate result. It should be acceptable to keep the buckets around for a bit longer until we try to get the memory usage again. We do need to handle when we get a negative sum though.