-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-7538: [Java] Clarify actual and desired size in AllocationManager #6204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
jacques-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! A few small comments, otherwise looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a waste of heap space, no? Since AllocationManager is abstract, let's just make getAllocatedSize() abstract in the base class. If a child class needs to store the value, they can add the field. I didn't realize the waste on the initial patch, just now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah I was actually wondering about this when I implemented this - "why not just make getSize() abstract" . I will make the adjustment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove this method.
walterddr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jacques-n I updated the PR based on your comment. please kindly take a look and see if this is what you had in mind. --Rong
java/memory/src/main/java/org/apache/arrow/memory/AllocationManager.java
Outdated
Show resolved
Hide resolved
| /** | ||
| * Returns the underlying memory chunk size managed. | ||
| * | ||
| * <p>NettyAllocationManager manages memory chunk by the exact requested size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this description accurate? I am not sure but I also lean into explain a bit more:
| * <p>NettyAllocationManager manages memory chunk by the exact requested size. | |
| * <p>NettyAllocationManager manages memory chunk by computing the allocatedSize based on the requestedSize. Thus the allocatedSize should be returned instead of the initial requestedSize. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be:
NettyAllocationManager rounds requested size up to the next power of two.
jacques-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks. Let's just update the one comment to be clearer as described below.
| /** | ||
| * Returns the underlying memory chunk size managed. | ||
| * | ||
| * <p>NettyAllocationManager manages memory chunk by the exact requested size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably should be:
NettyAllocationManager rounds requested size up to the next power of two.
| public long getSize() { | ||
| return size; | ||
| } | ||
| protected abstract long getSize(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh shoot, I just realized you're reducing visibility her on a public interface. You should keep this public. Sorry I missed this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. I was actually meaning to check in with you on this. (I think this interface should be protected) but sure we should keep it public for backward compatibility.
jacques-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm +1. Thanks @walterddr!
jacques-n
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm +1. Thanks @walterddr!
|
going to merge. |
This is a follow up on apache#5973. Closes apache#6204 from walterddr/ARROW-7538 and squashes the following commits: 15878d1 <Rong Rong> revert change and make API still public 10547bf <Rong Rong> address patch comment 97e7d3b <Rong Rong> address patch comments 489c203 <Rong Rong> fix checkstyle 1784f92 <Rong Rong> fix requested and allocated size difference Authored-by: Rong Rong <rongr@apache.org> Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
This is a follow up on #5973.