CurtHagenlocher commented on PR #538:
URL: https://github.com/apache/arrow-dotnet/pull/538#issuecomment-7422247445

   The `Memory` getter racing with `Dispose` of the same buffer is a 
use-after-dispose by the caller. Even a consistent snapshot could be released 
as soon as the getter returns, so no ordering inside the getter makes that 
safe. Clearing `_memory` on release makes the losing side see an empty buffer 
rather than memory that may already be freed. Returning "either the full memory 
or `ObjectDisposedException`" would need a full fence between the two reads on 
weakly ordered hardware, and `Memory` is on the per-element path, so this 
leaves it as is. `Retain` was different because losing that race created a new, 
independently owned buffer with the wrong length; that cost nothing to fix.
   


-- 
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