Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/283#discussion_r46227624 --- Diff: exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java --- @@ -186,42 +137,110 @@ private final void checkIndexD(int index, int fieldLength) { * @param start The starting position of the bytes to be read. * @param end The exclusive endpoint of the bytes to be read. */ - public void checkBytes(int start, int end){ - if (BOUNDS_CHECKING_ENABLED) { + public void checkBytes(int start, int end) { + if (BoundsChecking.BOUNDS_CHECKING_ENABLED) { checkIndexD(start, end - start); } } private void chk(int index, int width) { - if (BOUNDS_CHECKING_ENABLED) { + if (BoundsChecking.BOUNDS_CHECKING_ENABLED) { checkIndexD(index, width); } } - private void chk(int index) { - if (BOUNDS_CHECKING_ENABLED) { - checkIndexD(index); + private void ensure(int width) { + if (BoundsChecking.BOUNDS_CHECKING_ENABLED) { + ensureWritable(width); } } - private void ensure(int width) { - if (BOUNDS_CHECKING_ENABLED) { - ensureWritable(width); + /** + * Create a new DrillBuf that is associated with an alternative allocator for the purposes of memory ownership and + * accounting. This has no impact on the reference counting for this allocator. + * + * This operation has no impact on the reference count of this DrillBuf. The newly created DrillBuf with either have a + * reference count of 1 (in the case that this is the first time this memory is being associated with the new + * allocator) or the current value of the reference count + 1 for the other AllocatorManager/BufferLedger combination + * in the case that the provided allocator already had an association to this underlying memory. --- End diff -- "This operation has no impact on the reference count of this DrillBuf." Is this true only if the provided allocator is different from the current one?
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---