Github user julienledem commented on a diff in the pull request: https://github.com/apache/drill/pull/283#discussion_r46309770 --- Diff: exec/memory/base/src/main/java/io/netty/buffer/DrillBuf.java --- @@ -733,17 +790,98 @@ public byte getByte(int index) { return PlatformDependent.getByte(addr(index)); } - public static DrillBuf getEmpty(BufferAllocator allocator, Accountor a) { - return new DrillBuf(allocator, a); + @Override + public void close() { + release(); } - public boolean isRootBuffer() { - return rootBuffer; + /** + * Returns the possible memory consumed by this DrillBuf in the worse case scenario. (not shared, connected to larger + * underlying buffer of allocated memory) + * + * @return Size in bytes. + */ + public int getPossibleMemoryConsumed() { + return ledger.getSize(); } - @Override - public void close() { - release(); + /** + * Return that is Accounted for by this buffer (and its potentially shared siblings within the context of the + * associated allocator). + * + * @return Size in bytes. + */ + public int getActualMemoryConsumed() { + return ledger.getAccountedSize(); + } + + private final static int LOG_BYTES_PER_ROW = 10; + /** + * Log this buffer's byte contents in the form of a hex dump. + * + * @param logger where to log to + * @param start the starting byte index + * @param length how many bytes to log + */ + public void logBytes(final Logger logger, final int start, final int length) { --- End diff -- should this just be ```toString(start, length)``` leaving logging to the caller?
--- 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. ---