Skip to content

Conversation

@walterddr
Copy link
Contributor

This is a follow up on #5973.

@github-actions
Copy link

Copy link
Contributor

@jacques-n jacques-n left a 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.

Copy link
Contributor

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.

Copy link
Contributor Author

@walterddr walterddr Jan 15, 2020

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

Copy link
Contributor

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.

Copy link
Contributor Author

@walterddr walterddr left a 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

/**
* Returns the underlying memory chunk size managed.
*
* <p>NettyAllocationManager manages memory chunk by the exact requested size.
Copy link
Contributor Author

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:

Suggested change
* <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.

Copy link
Contributor

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.

Copy link
Contributor

@jacques-n jacques-n left a 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.
Copy link
Contributor

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();
Copy link
Contributor

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.

Copy link
Contributor Author

@walterddr walterddr Jan 16, 2020

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.

Copy link
Contributor

@jacques-n jacques-n left a 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!

Copy link
Contributor

@jacques-n jacques-n left a 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!

@emkornfield
Copy link
Contributor

going to merge.

pribor pushed a commit to GlobalWebIndex/arrow that referenced this pull request Oct 24, 2025
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants