lidavidm commented on code in PR #36185:
URL: https://github.com/apache/arrow/pull/36185#discussion_r1246538317
##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/Accountant.java:
##########
@@ -169,9 +169,14 @@ public boolean forceAllocate(long size) {
*/
private AllocationOutcome.Status allocate(final long size, final boolean
incomingUpdatePeak,
final boolean forceAllocation, AllocationOutcomeDetails details) {
- final long newLocal = locallyHeldMemory.addAndGet(size);
+ final long oldLocal = locallyHeldMemory.getAndAdd(size);
+ final long newLocal = oldLocal + size;
+ // Borrowed from Math.addExact (but avoid exception here)
Review Comment:
Exception handlers may have a performance penalty (even if not invoked), and
this code is meant to be fast.
--
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]