DRILL-1322: Fix memory leak when all records in a batch are filtered

Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/2275da9c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/2275da9c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/2275da9c

Branch: refs/heads/master
Commit: 2275da9c2c0aaf072172bff302f8b11800989e35
Parents: f1136ab
Author: Mehant Baid <meha...@gmail.com>
Authored: Fri Aug 22 01:03:47 2014 -0700
Committer: Jacques Nadeau <jacq...@apache.org>
Committed: Sun Aug 24 12:03:26 2014 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/drill/exec/record/WritableBatch.java    | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/2275da9c/exec/java-exec/src/main/java/org/apache/drill/exec/record/WritableBatch.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/record/WritableBatch.java 
b/exec/java-exec/src/main/java/org/apache/drill/exec/record/WritableBatch.java
index 97f665a..b55ed82 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/record/WritableBatch.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/record/WritableBatch.java
@@ -132,8 +132,10 @@ public class WritableBatch {
       metadata.add(vv.getMetadata());
 
       // don't try to get the buffers if we don't have any records. It is 
possible the buffers are dead buffers.
-      if (recordCount == 0)
+      if (recordCount == 0) {
+        vv.clear();
         continue;
+      }
 
       for (ByteBuf b : vv.getBuffers()) {
         buffers.add(b);

Reply via email to