Github user adeneche commented on a diff in the pull request:
https://github.com/apache/drill/pull/163#discussion_r40047181
--- Diff:
exec/java-exec/src/main/java/org/apache/drill/exec/memory/AtomicRemainder.java
---
@@ -76,16 +74,17 @@ public void setLimit(long limit) {
}
/**
- * Automatically allocate memory. This is used when an actual allocation
happened to be larger than requested. This
- * memory has already been used up so it must be accurately accounted
for in future allocations.
+ * Automatically allocate memory. This is used when an actual allocation
happened to be larger than requested, or when
+ * a buffer has it's ownership passed to another allocator.<br>
+ * This memory has already been used up so it must be accurately
accounted for in future allocations.
*
- * @param size
+ * @param size extra allocated memory that needs to be accounted for
*/
public boolean forceGet(long size) {
if (get(size, this.applyFragmentLimit)) {
return true;
} else {
- availableShared.addAndGet(size);
+ availableShared.addAndGet(-size);
--- End diff --
It can become negative if the allocator takes ownership of a buffer and
exceeds it's maximum allocated memory. Negative values are handled properly, at
least that's my understanding
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---