zanmato1984 commented on PR #40647:
URL: https://github.com/apache/arrow/pull/40647#issuecomment-2016558542

   I like this PR. But I have a question similar to @mapleFU 's.
   
   IIUC, the memory pool stats update is not fully synchronized with the actual 
allocator action (alloc/dealloc) so it should be expected to be "accurate most 
of the time" rather than "accurate all the time". For example, it could be the 
case that two concurrent threads have the following interleaving:
   1. Thread 1 allocates 1MB (actual peak memory 1MB)
   2. Thread 2 allocates 2MB (actual peak memory 3MB)
   3. Thread 1 updates stats (stats allocated memory 1MB, peak memory 1MB)
   4. Thread 1 frees 1MB
   5. Thread 1 updates stats (stats allocated memory 0MB, peak memory 1MB)
   6. Thread 2 updates stats (stats allocated memory 2MB, peak memory 2MB)
   ...
   
   Given the above nature of memory pool stats, should relaxed memory order be 
good enough (assuming it has better performance)? Though it is more 
"inaccurate" than acq-rel.
   
   Thanks.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to