arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [2/6] arrow git commit: ARROW-1108: [JAVA] Check if ArrowBuf is empty buffer in getActualConsumedMemory() and getPossibleConsumedMemory()
Date Thu, 08 Jun 2017 22:00:02 GMT
ARROW-1108: [JAVA] Check if ArrowBuf is empty buffer in getActualConsumedMemory() and getPossibleConsumedMemory()

Closes #744


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/6d71b8c4
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/6d71b8c4
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/6d71b8c4

Branch: refs/heads/master
Commit: 6d71b8c44d5af72a0c8dab79fc16718e21d5ee8d
Parents: 6c3024b
Author: Steven Phillips <steven@dremio.com>
Authored: Mon Mar 27 14:24:01 2017 -0700
Committer: Steven Phillips <steven@dremio.com>
Committed: Thu Jun 8 14:57:45 2017 -0700

----------------------------------------------------------------------
 java/memory/src/main/java/io/netty/buffer/ArrowBuf.java | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/6d71b8c4/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
----------------------------------------------------------------------
diff --git a/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java b/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
index e777b5a..06272a7 100644
--- a/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
+++ b/java/memory/src/main/java/io/netty/buffer/ArrowBuf.java
@@ -796,6 +796,9 @@ public final class ArrowBuf extends AbstractByteBuf implements AutoCloseable
{
    * @return Size in bytes.
    */
   public int getPossibleMemoryConsumed() {
+    if (isEmpty) {
+      return 0;
+    }
     return ledger.getSize();
   }
 
@@ -807,6 +810,9 @@ public final class ArrowBuf extends AbstractByteBuf implements AutoCloseable
{
    * @return Size in bytes.
    */
   public int getActualMemoryConsumed() {
+    if (isEmpty) {
+      return 0;
+    }
     return ledger.getAccountedSize();
   }
 


Mime
View raw message