Possible memory leak in NIODataInputStream
patch by Robert Stupp; reviewed by Stefania for CASSANDRA-11867
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ffd10a9b
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ffd10a9b
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ffd10a9b
Branch: refs/heads/trunk
Commit: ffd10a9b9a391f6bb55daa7e9365bff34f945f73
Parents: d6ffa4b
Author: Robert Stupp <snazy@snazy.de>
Authored: Tue May 24 09:41:04 2016 +0200
Committer: Robert Stupp <snazy@snazy.de>
Committed: Tue May 24 09:41:04 2016 +0200
----------------------------------------------------------------------
CHANGES.txt | 1 +
src/java/org/apache/cassandra/io/util/NIODataInputStream.java | 6 ++++--
2 files changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index af97cd1..d7ca9e5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
2.2.7
+ * Possible memory leak in NIODataInputStream (CASSANDRA-11867)
* Fix commit log replay after out-of-order flush completion (CASSANDRA-9669)
* Add seconds to cqlsh tracing session duration (CASSANDRA-11753)
* Prohibit Reverse Counter type as part of the PK (CASSANDRA-9395)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/ffd10a9b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
index 94ba9ed..ebeb8ba 100644
--- a/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
+++ b/src/java/org/apache/cassandra/io/util/NIODataInputStream.java
@@ -44,7 +44,7 @@ import com.google.common.base.Preconditions;
public class NIODataInputStream extends InputStream implements DataInput, Closeable
{
private final ReadableByteChannel rbc;
- private final ByteBuffer buf;
+ private ByteBuffer buf;
public NIODataInputStream(ReadableByteChannel rbc, int bufferSize)
@@ -277,7 +277,9 @@ public class NIODataInputStream extends InputStream implements DataInput,
Closea
@Override
public void close() throws IOException
{
- rbc.close();
+ rbc.close();
+ FileUtils.clean(buf);
+ buf = null;
}
@Override
|