LakshSingla commented on code in PR #15987:
URL: https://github.com/apache/druid/pull/15987#discussion_r1512991813
##########
processing/src/main/java/org/apache/druid/frame/allocation/HeapMemoryAllocator.java:
##########
@@ -53,7 +53,7 @@ public static HeapMemoryAllocator unlimited()
@Override
public Optional<ResourceHolder<WritableMemory>> allocate(final long size)
{
- if (bytesAllocated < capacity - size) {
+ if (size <= capacity - bytesAllocated) {
Review Comment:
In practice, `capacity = Long.MAX_VALUE`, therefore this edge condition
won't trigger ever in a meaningful way. One thing I can do is break the
abstraction and add `VisibleForTesting` to the constructor for the check.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]